Painfully Slow Build time for C++ projects

If I modify a single line in a single c++ file, I should not get these painfully long 10 minute build times. I have a game box, it’s top of the line, and is very fast. So why the slow build times?
If I just manually compile the single c++ file, it compiles write away, so a build should be quick, since I did not touch any headers, also I a building not rebuilding the entire project…so what is going on here?

Which version of engine are you on?

The older versions would include the whole engine in the build making compile times very long.

All from around 4.26 and up require manual includes which makes compiles a lot faster.

1 Like

I am using UE5.2.
There is a UE5 project included in solution (for C++ plugin).
But it is disabled by default. Even if I select re-build, it should not rebuild the UE5 project. But let’s just say I only pick build. It is painfully slow…

If I modify a single C++ file. I can go to the build menu and compile the one and single file. It will compile right away. Now the *.obj file is created so there should be zero need to recompile anything else (unless I touched a header file which is not the case). So after compiling the one and single c++ file if I go now and build (not rebuild) project it should go straight to the linker phase and link up the project obj modules…which should be quick.
But it takes 10 minutes or more for a build to be done even when only one single c++ file is modified. Again, yes, there is a UE5 project (by default) in the solution, but its build is disabled. I will try and remove project altogether and see what happens.

I tried unloading the UE5 project…it didn’t help.
Then I went and completely removed the UE5 project from the solution.
That didn’t help either…
If I just add a stupid line like “long x = 0;”
It will take 10 minutes to build the project. Something is wrong…
I remember Microsoft said (a long while ago) that in the past, if you modified a source file, the date on the file is updated, and the build system takes that into account on a file by file basis. But a long time ago Microsoft said they optimized the compiler on a function level basis…so if only 1 single function withing a *.cpp file got modified, only that one function was recompiled. Now if you modify header files, that’s another story…

Oh…wait…I tried a rebuild and it reported that it took 32 seconds…before it did not do that…let me retry again.

OK…much better now!
I don’t know, even if the UE5 project is unmarked in build config…does it get built???
Anyway here is what I did.
I unloaded UE5…it did not help.
So I deleted the UE5 project altogether.
A complete rebuild now only took 1 minute.
A BUILD of project where I only modify a single *.cpp, now took only 5 seconds!
Great! Thx for help.

■■■■, it’s back again…it was great for a little while…
Now it’s back to 10-12 minutes to compile a single c++ file.
I don’t know what’s going on…sometimes it will build in 5 or so seconds…sometimes it will take 10-12 minutes. Now, I am NOT touching any headers or even other c++ files…so it should not be doing this…the c++ file I am working on is not even big, it’s a couple of pages worth of basic code.
So…I don’t know what the issue is.

========== Build started at 11:53 PM and took 23:15.985 minutes ==========

23 MINUTES!!!
All I did was move 5 lines of code in one function to another function in the one and only c++ file. I didn’t do a rebuild. Just a build. I didn’t touch anything else.

So now it’s twice as bad. This was after I rebooted to see if that would help clear out memory or something. I had nothing else running.

I went and deleted the Binaries folder, the .vc folder and the intermediate folder and the solution file, then I recreated the *.sln file and loaded that up in VS, then unloaded the UE5 project and did a normal build (no rebuild). It was pretty fast (the entire project was built)…maybe 15 seconds. It fixed issue, but I don’t know if it will creep back or not.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.