I get an error “this declaration has no storage class or type specifier”.
I tried to compile it first in the unreal editor, build the project in different configurations (debug, dev editor etc…), reopen VS and UE, include Delegate.h.
I have no idea if I’m doing something wrong or its a bug, I’m new to UE.
Thanks in advance.
Edit: Both of the errors I noticed are IntelliSense errors because the program compiles, but they are leading to compilation error when in the .cpp file I try to
OnOpenRequest.BroadCast();
which says: error C2039: ‘BroadCast’: is not a member of ‘FOnOpenRequest’.
Solution: The problem was uppercase ‘C’ instead of lower case in the Broadcase();. The problematic intellisense won’t do auto completion.
Are you including declaration to the file where you are trying to create a variable?
Have you tried regenerate projects file? (right click on .uproject file)
The first error: “this declaration has no storage class or type specifier”, is intellisense only. It gets compiled both in the VS and UE.
But the second one is compilation “FOnOpenRequest is undefined”.
Yea, i have a feeling its maybe something with the includes but I did include “Delegates/Delegate.h” and also #include “CoreMinimal.h”.
Both the delegate declaration and the UPROPERTY are in the same .h file in my project.
Yes, you are right. both errors were intellisense, I had a problem with spelling BroadCast() instead of Broadcast, didn’t notice because no auto completion of intellisense.
Then switch the solution configuration to anything (e.g. Development Editor to Development Client), then switch it back to the original, and the Intellisense should work again.
I was honestly just trying to make a completly standard Event Dispatcher.
Yet this is the method that pops up as the suggested one. A dynamic multicast is not required for most cases. Read more in this discussion…
My solution: Drop the DYNAMIC and it works (including delegate.h was not nessesary).
Sorry for the 6 year necro post, but I was having issues with this as well and your response was the first that fixed it. It is also a very simple and logical solution so I appreciate that, too!