Download

Function definition not found if enum parameter isn't a the end

Hi ! I’m becoming crazy on the stranger bug I never saw.

In the .h :
void MyFunc(FMyStruct Arg1, TEnumAsByte<EMyEnum> Arg2, float Arg3, int32& Arg4);

In the cpp :
void MyFunc(FMyStruct Arg1, TEnumAsByte<EMyEnum> Arg2, float Arg3, int32& Arg4)

This don’t work. The function definition is not found, exactly like if the function was not declared in the C++.

When I use the declaration creation in VS, it add in the cpp this :
void MyFunc(FMyStruct Arg1, int32& Arg4, TEnumAsByte<EMyEnum> Arg2, float Arg3)
And this declaration is incompatible…

It’s not on all function, only few one. Some are bugged, other not, with the same argument… All of this have no sense.

I already tried to delete binaries and intermediate folder and rebuild, same result. Is there somewhere some cache files which can store this error ?

Edit1 : I tried to replace the enum by an int parameter, same bug. It doesn’t seem to be linked to the parameter type… I have no idea what to do.

fully qualify the function name in the cpp file

AMyClass::MyFunc()

Well, we don’t know from what this bug was but a full re-setup of the full project fixed it.

The name you give the parameters doesn’t matter at all to C++ – only the order matters.
Also, when you declare a function as a member of a class in a header, you have to then define it scoped to that class in the C++ file (AYourClass::MyFunc(…))

Yes it was done on my file, I forgot it here. This wasn’t the problem. Surely a compilation bug.

Compilers generally don’t have bugs in parsing standard language syntax. The bugs that tend to be found in compilers are generally quite obscure.

It’s almost certainly something that got mis-matched or configured wrong – computers don’t have random number generators on the inside to figure out what “build” means – but if you don’t have the files still, then it’s impossible to debug and figure out what it is.

Good news: You started over and don’t have this problem now.
Bad news: If the problem happens again, you don’t yet know what causes it, and thus it will take longer to debug it at that time.