I’ve been used UE4 for a few months now, and my project becomes more and more consequently, since today.
In total, I have 29 .cpp files in my Source folder, and when i create one more (even empty), the build explodes.
I have 100+ link errors in header files (that has no problems before). And when I delete this new .cpp file, the project compiles normally without errors.
My problem is similar to this one :
But I haven’t duplicated headers.
The only difference that i found is with a project with 30 and more .cpp files, the build console say :
1>[Adaptive unity build] Disabling PCH for excluded files. Set bAdaptiveUnityDisablesPCH to false in BuildConfiguration.xml to change this behavior.
1>[Adaptive unity build] Excluded from [ProjectName] unity file: (many files...)
These lines don’t appear when the project contains 29 .cpp files.
I’m a beginner with the C++ programmation, maybe I miss something else ?
The errors are about the FJsonObject and FJsonValue classes in the Json module.
I normally not include the header of these classes but when I build with 30+ .cpp files, I’m forced to include them in each file that use the Json module, also in the source code of plugins that I use and I’d rather not touch that part of code that is not mine.
I tried this and I also tried to remove the Saved, Intermediate, Binaries and .vs folders, and regenerate the visual studio project file. I tried to clean the project with visual studio, to rebooet the IDE and my computer, without results.
Have you added the Json module to the AdditionalDependencies in your uproject file? This should be necessary for UHT as it builds in a separate module. Please attach the complete log of your failing build, so one can get a better clue on what is causing the issue.
In fact I was referring to the *.uproject file. (Not sure if you gain the same result when adding dependend modules via the *.build.cs.)
From what I get from your log, my approach would be to start with fixing globals.h and OtherPlayerManager.h. Looks like there is some include, include guard or (forward) declaration missing. (Remember that an include is just textual replacement and you always need to have all used types, functions, … to be declared before their usage.)
Regarding the 30 files “limit” you observe I suppose this is related to Unreals unity build which merges several compile units into one. From my experience this means that an include from one file can become effective for another file (when it is merged to the new compile unit below the latter), so the second file will (and should) fail to build when it is compiled alone or in another merged context.