Hitting D8049 errors when building editor from UE4.sln

Short one

When building my game from Visual Studio 2017 in Editor configuration (tried both version 15.9.6 and 15.9.12), I hit this error

cl : Command line error D8049: cannot
execute ‘c:\program files
(x86)\microsoft visual
studio\2017\professional\vc\tools\msvc\14.16.27023\bin\hostx64\x64\c1xx.dll’: command line is too long to fit in
debug record

This is similar to the CLion question with the same problem, except the suggested workaround does not apply to me.

Since I don’t control how cl is invoked, what can I do to workaround this issue? I tried building both DebugGame_Editor and Development_Editor

Did you ever find a solution to this? We have the same issue, and we aren’t using CLion. Only happens on 4.23

Me too. But in my team not everyone suffer from this.

I believe this is fixed in the latest version of the engine

For future answer seekers getting this error, you can fix it by adding bLegacyPublicIncludePaths = false; to your [ProjectName].Build.cs file (or whichever module is failing).

This requires you to fix all your header includes though, but that’s just healthy for your project.
The reason your build is failing is because legacy behavior is to append all public include paths to the build tool’s command line. This doesn’t scale and fails eventually as a project grows for tools with smaller commandline buffer. Turning off legacy include paths stops appending them to the command line at the cost of you having to put in the actual correct path for each header. But you’d want to have correct include paths anyways, right? :slight_smile:

UE4 has a commandlet to help with fixing your include paths:
RunUAT.bat RebasePublicIncludePaths -Project="path/to/project.uproject" -UpdateDir="path/to/code" -Write

If you have many modules you might want to turn it on for all of them, but you can also put that same boolean into your *.Target.cs files to force it for all modules in your targets.

2 Likes

There are too many of this error.

This worked for me. It caught 2 include paths that needed correcting in Runtime Mesh Component too.

I should add, in UE 4.25.

I ran into this very error when building UE4 27.1 release version from source (win64, Windows 10, VS2017). For me, the following solution worked:

To prevent the cl : Command line error D8049: cannot execute 'c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\bin\hostx64\x64\c1xx.dll': command line is too long to fit in debug record error, in the UE4 project, in UE4Client.Target.cs, UE4Editor.Target.cs, UE4Game.Target.cs and UE4Server.Target.cs,
add the line: bLegacyPublicIncludePaths = false;.

1 Like