# How to compile C++ code faster?

**URL:** <https://forums.unrealengine.com/t/how-to-compile-c-code-faster/528298>\
**Category:** C++\
**Tags:** unreal-engine, UE5-0, question, CPP\
**Created:** [April 14, 2022, 1:47pm UTC](https://forums.unrealengine.com/t/how-to-compile-c-code-faster/528298 "2022-04-14T13:47:34Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![caiovini980](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/caiovini980/32/1074450_2.png) [@caiovini980](https://forums.unrealengine.com/u/caiovini980)\
**Post date:** [April 14, 2022, 1:47pm UTC](https://forums.unrealengine.com/t/how-to-compile-c-code-faster/528298/1 "2022-04-14T13:47:34Z")

</div>

Hey everyone!  
I’ve just started to work with Unreal this week and a thing that is bothering me is that I’m constantly waiting 5 to 10 minutes to the engine to compile my code (event the smallest ones) when it have any modification.  
Does anyone know how could I fix this? How could I make this compile time faster? Is it something retated to my setup?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [April 14, 2022, 1:52pm UTC](https://forums.unrealengine.com/t/how-to-compile-c-code-faster/528298/2 "2022-04-14T13:52:12Z")

</div>

That’s too long, shouldn’t be that way.  
Look at the size of your Binaries folder. IDK about Visual Studio, but when you compile in the engine, it creates files in Binaries, and they pile up really quickly to dozens of gigabytes. You can safely delete them. Sometimes it helps to speed up compilation.

---

<div class="post-metadata">

**Author:** ![Countsie](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/countsie/32/1194632_2.png) [@Countsie](https://forums.unrealengine.com/u/Countsie)\
**Post date:** [April 16, 2022, 5:09am UTC](https://forums.unrealengine.com/t/how-to-compile-c-code-faster/528298/3 "2022-04-16T05:09:04Z")

</div>

How are you compiling? Maybe you’re re-building the entire solution each time?

It should only be building your changed files and maybe dependents… should only take a 5-10 seconds compiling a small change.

---

<div class="post-metadata">

**Author:** ![caiovini980](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/caiovini980/32/1074450_2.png) [@caiovini980](https://forums.unrealengine.com/u/caiovini980)\
**Post date:** [April 20, 2022, 12:56am UTC](https://forums.unrealengine.com/t/how-to-compile-c-code-faster/528298/4 "2022-04-20T00:56:17Z")

</div>

I’m compiling through the engine, maybe this Binaries solution works, I’ll test and update here later.

Thanks!

---

<div class="post-metadata">

**Author:** ![Countsie](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/countsie/32/1194632_2.png) [@Countsie](https://forums.unrealengine.com/u/Countsie)\
**Post date:** [April 20, 2022, 12:59am UTC](https://forums.unrealengine.com/t/how-to-compile-c-code-faster/528298/5 "2022-04-20T00:59:32Z")

</div>

Look thru this thread… you might be having similar issues:

> [@Why does UE5 compile every module every time?](https://forums.unrealengine.com/t/why-does-ue5-compile-every-module-every-time/521356/12):
>
> Another workaround I found is to move the plugin’s project folder from the engine folder into your project/Plugins folder so that it builds alongside your project. This makes your project more portable too, so I think I’m actually going to be doing this regardless for any plugins I acquire from now on.

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [April 20, 2022, 7:19am UTC](https://forums.unrealengine.com/t/how-to-compile-c-code-faster/528298/6 "2022-04-20T07:19:41Z")

</div>

By the way, each plugin has its own Binaries folder that grows too when you compile via the engine. You should clean them up as well from time to time.

---

<div class="post-metadata">

**Author:** ![Hexavx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Hexavx](https://forums.unrealengine.com/u/Hexavx)\
**Post date:** [April 21, 2022, 10:42am UTC](https://forums.unrealengine.com/t/how-to-compile-c-code-faster/528298/7 "2022-04-21T10:42:58Z")

</div>

What is your computer specs?  
Modifying the h file will require the files which including the h file to recompile, you can move some code which you are experimenting to cpp file.  
You can expose some variable to blueprint, so you can modify the value withou recompile.

---

<div class="post-metadata">

**Author:** ![neofuturelabs](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/neofuturelabs/32/1194562_2.png) [@neofuturelabs](https://forums.unrealengine.com/u/neofuturelabs)\
**Post date:** [April 23, 2022, 5:18am UTC](https://forums.unrealengine.com/t/how-to-compile-c-code-faster/528298/8 "2022-04-23T05:18:08Z")

</div>

If the slow compilation times are in UE5 (noticed that this post is tagged as such), then this other thread could be related:

> [@Compilation taking twice as long in UE5: Number of processes being limited?](https://forums.unrealengine.com/t/compilation-taking-twice-as-long-in-ue5-number-of-processes-being-limited/533454):
>
> I updated my project from version 4.27.2 to 5.0.0 and C++ compilation is taking about twice as long, sometimes longer. This occurs for both compilation from Visual Studio and for Live Coding. Looking at the compilation logs, the main difference appears to be that the number of processes is lower in UE5. Refer to the below logs: Visual Studio Community 2019 16.11.12, toolchain 14.29.30142 Windows 10.0.19041.0 SDK Intel(R) Core™ i7-6700 CPU @ 3.40GHz (Cores: 4, Logical processors: 8) Test cas…

It seems that when compiling in UE5, fewer processes are created and/or the cpu isn’t being used at full capacity. This becomes obvious when comparing compilation performance between UE4 and UE5. Not sure yet if this is affecting all users, and whether or not this is a known issue by Epic. Hoping for an official response like “we are aware of this issue and it will be fixed in 5.0.2” or something along those lines.

---

<div class="post-metadata">

**Author:** ![DiliupG](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/diliupg/32/1071099_2.png) [@DiliupG](https://forums.unrealengine.com/u/DiliupG)\
**Post date:** [August 19, 2022, 9:14am UTC](https://forums.unrealengine.com/t/how-to-compile-c-code-faster/528298/9 "2022-08-19T09:14:09Z")

</div>

Have you seen this solution?  
[Speed up Unreal Engine compile time!](https://www.reddit.com/r/unrealengine/comments/sqzbk6/speed_up_ue5_compiling_like_20_times_faster_my/)

---

<div class="post-metadata">

**Author:** ![Roy\_Wierer.Seda145](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roy_wierer.seda145/32/906551_2.png) [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Post date:** [August 19, 2022, 11:27am UTC](https://forums.unrealengine.com/t/how-to-compile-c-code-faster/528298/10 "2022-08-19T11:27:51Z")

</div>

As Hexavx said, modifying a header file requires everything to recompile. You should forward declare your classes in the header file and move all #include and method implementation to the cpp files. You should also use the Unity system by enabling it in your build.cs files of the project and plugins you want to compile. Other than this VS is just a slow old beast. Sometimes it can hang for 5 minutes “building tasks…” at which point I noticed aborting the build and cleaning the project first results in a faster next build. Your RAM usage should be kept as low as possible, if RAM is high you won’t be compiling quickly.

---

<div class="post-metadata">

**Author:** ![provnking111](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@provnking111](https://forums.unrealengine.com/u/provnking111)\
**Post date:** [July 22, 2025, 2:54am UTC](https://forums.unrealengine.com/t/how-to-compile-c-code-faster/528298/11 "2025-07-22T02:54:36Z")

</div>

I think I found a solution, not sure if it’s relate to ur C++ compile, when I start my c++ project by going into epic game launcher, and launch game in there manually, and compiling my c++, the time it take is 40s, but if I launch my project in visual studio 2022 the current version of VS, and press c + f5 which is start the project without debugging, after compile my C++ code, it’s take 1.3s
