Hi everyone, I recently started using UE4. I had previously used Unity for awhile, but ultimately UE4 looks to be the much better fit for me. The inclusion of Blueprints is nice and the fact it uses C++ for creating new gameplay features and engine modification and that it’s so open is great. I am an experience C++ programmer and am kind of just at the stage where I’m seeing how my workflow is going to be for UE4 projects. I’ve been going through all the tutorials to learn all I can about the editor and what it can do before jumping into learning the API better and designing unique gameplay/engine enhancements.
Well during the HelloWorld program that has you add a C++ file to a project and then run the game to have it display to the screen I ran into a little snag. Before doing this tutorial I tried to just add my own test class to a project and then use it in the editor, but that didn’t work. It looks like there are various macros that you need to include in your code to get the editor to recognize custom classes. So I decided to try the programming tutorials. I am using the launcher download version of the engine. I was able to build version 4.5 myself, but I want to use 4.6 and for some reason I couldn’t build 4.6 without errors.
Getting to the problem and question: so the tutorial has me start the editor then goto File-> Add code files… and when I do it launches VS2013. I make my changes on the *.h and *.cpp files and then try to build. I am getting an error.
1>------ Build started: Project: LimbDamageSystem, Configuration: Development_Editor x64 ------ 1> Parsing headers for LimbDamageSystemEditor 1> C:/Users/B/Desktop/UE4 Related Files/MyProjects/001 - Prototypes/LimbDamageSystem/Source/LimbDamageSystem/Public/HelloWorldPrinter.h(21) : Expected an include at the top of the header: '#include "HelloWorldPrinter.generated.h"' 1>Error : Failed to generate code for LimbDamageSystemEditor - error code: OtherCompilationError (2) 1> UnrealHeaderTool failed for target 'LimbDamageSystemEditor' (platform: Win64, module info: C:\Users\Blake\Desktop\UE4 Related Files\MyProjects\001 - Prototypes\LimbDamageSystem\Intermediate\Build\Win64\LimbDamageSystemEditor\Development\UnrealHeaderTool.manifest). 1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command ""C:\Program Files\Unreal Engine\4.6\Engine\Build\BatchFiles\Build.bat" LimbDamageSystemEditor Win64 Development "C:\Users\Blake\Desktop\UE4 Related Files\MyProjects\001 - Prototypes\LimbDamageSystem\LimbDamageSystem.uproject" -rocket" exited with code -1. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Now the first problem regarding the “HelloWorldPrinter.generated.h” I know why that showed up because this particular error is from when I copied in my own code files without using the editor to add the files just to see if I could do that. The other error happens even if I use the editor to add code files.
So why is the error happening? My code is just an empty C++ first person template with the exact tutorial code of HelloWorldPrinter tutorial.
Also do we have to add code files from within the editor so a .generated.h file is created? Where is this file? I didn’t even see it when I used the editor to add code files yet it did compile past that part as if it was there.
I’m just trying to get an idea of how I’ll be adding files to projects and organizing them. Seems weird to have to launch the editor then add files then to recompile close the editor back down if I can just add them in and compile then launch editor when I want to test the new classes.