Just put my nose into C++ coming from blueprints. I can’t figure out why DECLARE_DELEGATE generates errors. More precisely, I’m doing the following in a character.h file (public) :
DECLARE_DYNAMIC_MULTICAST_DELEGATE_Three_Params(TheName, int32, a, int32, b, int32, c);
And for some reason, Visual Studio tells me that the macro is not defined. If I Ctrl+Click on it, it still redirects me to the Delegates/DelegateCombinations.h file
Okay, I wanted to republish a version of the .h cleaned up, but you replied too fast.
Unfortunately, moving the UENUM to the top didn’t fix it (but thanks by the way); here is my current file, which I just ran. I have the issue " declaration has no storage class or type specifier " for each DECLARE, which are underlined in red. MyCharacter.h (3.6 KB)
Your file compiles fine after moving the UENUM macro out of the UCLASS . Do not look at intellisense when it comes to delegates, it’s basically a red hearing. If you regenerate your project the underlines will go away.
The file generates no problem. Compile it and run refresh visual studio from within unreal
No errors. The green underlines are ok as delegates do not have implementations in the cpp file they are only declared in the header & later bound and called in the cpp.
Indeed, I had to regenerate the solution files. Maybe I should open another question for that, but what exactly does this provide ? Why didn’t it work before generating the solution files ?
Unreal doesn’t work on pure c++. It uses a “bridge” file in the form of the .generated files. These probably do some black magic with epic’s custom macros so that the engine can stitch itself together making c++ work with blueprints.
It’s a bit awkward & messy and it’s unfortunately a quirk of the engine. Not much more I can add. I’m sure an Epic engineer could explain it in detail.