Build failed when there are 30+ .cpp files in project

Hello,

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 ?

Thank you in advance for your help.

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.

My first guess would be that some chache is messed up. Try to do a clean rebuild of your project so all intermediate data gets regenerated.

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.

Have you added the Json module to the AdditionalDependencies in your uproject file?

If you’re talking about this line, yes :

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG", "UMGEditor", "Json", "JsonUtilities", "SIOJson", "Slate", "SlateCore", "SocketIOClient", "ProceduralMeshComponent"});

I’ve already run this module many times when I had less than 30 .cpp files.

You can check the log here.
The problems come from the socketio-client-ue4 plugin, but I didn’t have any problems with this plugin before this.

(Sorry for this account change, I I wasn’t able to reply to your comment with my previous account)

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.