x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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 : https://answers.unrealengine.com/questions/168056/adding-a-new-cpp-file-to-project-causes-other-clas.html

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.

Product Version: UE 4.19
Tags:
more ▼

asked Oct 04 '18 at 10:53 AM in C++ Programming

avatar image

Dight
1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

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.

more ▼

answered Oct 04 '18 at 01:37 PM

avatar image

Dight
1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Oct 04 '18 at 02:30 PM

avatar image

j.mueller RFG
304 3 10 10

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Oct 04 '18 at 02:42 PM

avatar image

Dight
1 1

avatar image j.mueller RFG Oct 04 '18 at 04:53 PM

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.

avatar image Zbluu Oct 04 '18 at 05:35 PM

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)

mmo-client-ue4.log (82.2 kB)
avatar image j.mueller RFG Oct 08 '18 at 04:09 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question