Hi,
Whenever I try to add a function* with UFUNCTION to my code I get a not very helpful error message:
’ * (note that function != method in this context, as in, a function NOT inside a class/struct)
1>------ Build started: Project: PowerTD, Configuration: Development_Editor x64 ------
2>------ Skipped Build: Project: UE4, Configuration: BuiltWithUnrealBuildTool Win32 ------
2>Project not selected to build for this solution configuration
1> Parsing headers for PowerTDEditor
1> D:/libs/ue4/PowerTD/Source/PowerTD/MapLoader.h(10) : LogWindows:Error: Windows GetLastError: The operation completed successfully. (0)
1>Error : Failed to generate code for PowerTDEditor - error code: CrashOrAssert (3)
1> UnrealHeaderTool failed for target 'PowerTDEditor' (platform: Win64, module info: D:\libs\ue4\PowerTD\Intermediate\Build\Win64\PowerTDEditor\Development\UnrealHeaderTool.manifest).
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command ""D:\ProgramFiles\Epic Games\4.8\Engine\Build\BatchFiles\Build.bat" PowerTDEditor Win64 Development "D:\libs\ue4\PowerTD\PowerTD.uproject" -rocket" exited with code -1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========
I investigate the command, and tried to run the “UnrealHeaderTool” with verbose mode to see whats going on, but the error message still unhelpful:
D:\ProgramFiles\Epic Games\4.8\Engine\Binaries\Win64>UnrealHeaderTool.exe "D:\libs\ue4\PowerTD\PowerTD.uproject" "D:\libs\ue4\PowerTD\Intermediate\Build\Win64\PowerTDEditor\Development\UnrealHeaderTool.manifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -rocket -installed -verbose
LogCompile:Error: Exporting native class declarations for /Script/CoreUObject
LogCompile:Error: Exporting native class declarations for /Script/InputCore
LogCompile:Error: Exporting native class declarations for /Script/SlateCore
LogCompile:Error: Exporting native class declarations for /Script/Slate
LogCompile:Error: Exporting native class declarations for /Script/EngineMessages
LogCompile:Error: Exporting native class declarations for /Script/EngineSettings
LogCompile:Error: Exporting native class declarations for /Script/Engine
D:/libs/ue4/PowerTD/Source/PowerTD/MapLoader.h(25) : LogWindows:Error: Windows GetLastError: The operation completed successfully. (0)
The function with UFUNCTION I’m trying to add is a very simple one I got from the wiki: A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums
In the “.h” file I have:
UFUNCTION(BlueprintCallable, Category = "Sunshine")
void ActivateSunShine();
and in the “.cpp” file I have:
void ActivateSunShine() {}
Any idea what might be causing this error?
Ps.: I started a brand new blueprint project, generated the C++ files, then created a C++ class based on “UObject” using the UE4Editor. Then tried to add the UFUNCTION above when I got the error message. The project compiles fine without the UFUNCTION.