I made a function and can’t compile it, since I get the error message C2511 “overloaded member function not found in ‘class’”.
Here are the .h .cpp and .gen.cpp lines of code:
As you can see, the UnrealHeaderTool seems to generate code, that is different from my function declaration.
The Enum is “EBlockTypes BlockType” instead of TEnumAsByte<EBlockTypes> BlockType, and the .gen.cpp puts a “&InstanceIndexMap” instead of “InstanceIndexMap”.
I have absolutely no idea why (I am a c++ rookie) and similar stuff that can be found via google is too different from my case. So I can’t transfer it to this issue.
Does someone know whats going on?
TEnumAsByte isn’t exposed to Blueprints and should only really be used for C++ variables. Just use the “normal” enum ‘EBlockTypes’ in your function, you can use TEnumAsByte::GetValue to convert to the raw enum and back to a byte.
Hey ExtraLifeMatt, thank you for the clarification. That’s the reason why it generates the ‘EBlockTypes’ I suppose?
And do you have an idea, why it generates the
‘const TMap<FVector,int32>& InstanceIndexMap’ instead of
Probably because you shouldn’t pass a TMap by value as it would copy the entire TMap over, so instead you should use a const reference when you want to pass it as read-only.
hey brunocoimbra, thanks for you answer. First of all, now it seems to work.
But to get this straight… I thought passing the parameter with “&” means passing as ‘reference’. So my TMap (class variable) is altered inside of the function. Which is exactly what I want to do, but I read, that ‘&’ means that unreal will interpret this as a Blueprint return value. Or am I mixing things up here?
And what does ‘const’ mean in this context? I read http://duramecho.com/ComputerInforma…wCppConst.html
What does this mean? I want it to be altered, don’t I? :eek: