When I edit the module header (the one which gets created by the editor and has the same name as the project) my project won’t build any more. I know that the code is actually correct as I can recreate the project and add the same source files and it builds (rebuilding the existing project doesn’t fix the problem I have to recreate it).
These are the first few lines for errors, but they are really not descriptive:
...
19> PCH.UTG.UTG.h.cpp
19>d:\dev\projects\ue4\engine\source\runtime\coreuobject\public\uobject\UObjectHash.h(52): error C2440: 'default argument' : cannot convert from 'EName' to 'FName'
19> Source or target has incomplete type
19>d:\dev\projects\ue4\engine\source\runtime\coreuobject\public\uobject\UObjectGlobals.h(10): error C2504: 'FLogCategory' : base class undefined
19>d:\dev\projects\ue4\engine\source\runtime\coreuobject\public\uobject\UObjectGlobals.h(10): error C2143: syntax error : missing ',' before '<'
19>d:\dev\projects\ue4\engine\source\runtime\coreuobject\public\uobject\UObjectGlobals.h(10): error C2039: 'Log' : is not a member of 'ELogVerbosity'
19>d:\dev\projects\ue4\engine\source\runtime\coreuobject\public\uobject\UObjectGlobals.h(10): error C2039: 'All' : is not a member of 'ELogVerbosity'
19>d:\dev\projects\ue4\engine\source\runtime\coreuobject\public\uobject\UObjectGlobals.h(10): error C2614: 'FLogCategoryLogUObjectGlobals' : illegal member initialization: 'FLogCategory' is not a base or member
...
So, this is in fact report of two problems:
Editing module header breaks the build.
Rebuilding the projects seems to not really clean everything.
I now know that I shouldn’t touch the module header, but this still looks like a thing that should be fixed.
Do you even edit the module header? I edited to add some includes as I thought the module header is always precompiled (but since then I learned it doesn’t have to be).
Let’s say you Game is called StrategyGame, then you are talking about StrategyGame.h right ? If yes, then yes I add more includes to this header and it works fine.
Hi Element9. If you start a brand new project from one of the templates, then edit the module header, do you get the same error? What are the exact edits that you are making to the module header?
I can’t try it at the moment, so I don’t know if it can be reliably replicated on a fresh project from a template. But the exact edit was to add one line:
#include <memory>
after
#include "Engine.h"
I’ll let you know when I try it on a new project from a template. (It did happen to me on more than one project, but I didn’t try it on a new project). Unfortunately, I won’t be able to do it any time soon.
I just tried creating a brand new project from a template and made the edit you mentioned, and it didn’t cause any problems. Did you base your project off of one of the templates, or did you start with a blank project? Did you make any changes to anything else as well?
I haven’t worked on my project for some time. I’ll update to UE 4.2 next week and continue to work on it next week. I’ll let you know if I can reproduce the problem in 4.2. Thank you for keeping an eye on this
Unfortunately I have still not been able to reproduce this issue. Are you able to make this happen in a brand new project? If so, can you provide the exact steps you are following?
Are you using the Development Editor solution configuration in Visual Studio? Are you using 4.2.1 or 4.2.0? Did you build your Engine from source code, or are you using the binary version through the Launcher?
Copy my .cpp and .h files into Source folder and add them to hte project
Build it again. It builds fine
Make any edit to the module header and build the project. I now get those errors when PCH.UE4Test04.UE4Test04.h.cpp was compiled. (The band new project I tried this in is called UE4Test04)
Same happens if in step 2 I pick “DebugGame Editor”.
I am using 4.2.1 and it is the version I got by downloading it through launcher.
Thank you for providing those files. When I added them to a project and edited the module header, I was able to see the errors that you described. I will have to do some digging to find out what is causing this to happen.
I was able to put some time into this issue again today. I think I have narrowed down where the problem is originating. It seems to be something inside your Map class.
What I did was start with a basic code project, built it, edited the game header file to add the #include line, built again, removed the #include line, built again. Then added in the classes you provided one at a time and repeated the steps above until the error appeared again. This is the order I added the classes in:
The Map class is where the error appeared, and removing that class allowed me to successfully build the project again. The next three lines worked fine without the Map class being included (UTGCharacter and Weapon were added at the same time since they depend on each other). I was not able to test the project with the Battle and TargetSelector classes since they require Map. I would suggest trying a new project with all of the classes up to Map included, then rebuild Map a little bit at a time until the error triggers again for you.
If you can narrow down what part of the Map class is triggering the error, we can try to investigate further to find a solution to the issue.
We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.