Download

How do i call a static function from an other Cpp class in Cpp ?

I want to use one of the functions i’v added to my MyBlueprintFunctionLibrary in Cpp too.
How do i reach them ?

First you need to include the header file their defined in and then you can call the method using the following syntax:



#include "MyLib.h

...
//In some other function
UMyLib::SomeFunction()
...



A class is considered a namespace so static members are accessed using the :: operator.

Ok it did it, i tried it at first but the class name has “U” at the beginning of it’s name and the header file doesn’t, didn’t know that is a valid scenario, thanks :slight_smile:

That is how Epic handles the source files, it’s pretty strange in the beginning when you’re not comfortable with it. The classnames themselve always have a prefix like U, A, F, T (which are the most common, you can make a quick Google search to find out, which others do exist), but the corresponding filenames are named without those prefixes. So AMyPlayerController is in MyPlayerController.h /.cpp

Thanks for the explanation :slight_smile: