How is one supposed to debug C++ compilation errors?

I am using Unreal Editor version 4.9.2 on Arch Linux, and I am trying to figure out how one is supposed to debug C++ compilation errors.

When a compilation error occurs after hitting the “compile” button, the little dialog will appear in the bottom right stating that “C++ compilation failed” and has a button that brings up the message log. When I look in the message log, all I can ever find is

ERROR: UBT ERROR: Failed to produce item: MyGame/Binaries/Linux/libUE4Editor-MyGame-####.so

This is entirely useless for me trying to determine the cause of the compilation issue, and the same message always seems to be given regardless of why compilation failed.

How is one supposed to debug C++ compilation issues? I’m sure the compiler output must be somewhere, but where? It obviously isn’t in the message log and I haven’t been able to find any information about this online (to my surprise).

Thanks for any help.

Check Output Log, you can find it in Window → Devloper Tools

If not you can compile from command line

UnrealBuildTool ProjectNameEditor Linux Debug “Path\To\ProjectName.uproject” -DEPLOY

Now i never used linux so i’m not sure if you should have “Linux” or something else (Linux64). Insted of Debug pick build configuration your engine is build, or else it might start compiling engine again.

You can also install Code::Blocks if i’m not mistaken UE4 support it on Linux and probably generate project files for it.

The first place I tried looking was the output log, that’s where I see the fairly useless UBT ERROR message I mention in my post, and that’s the only indication I see that the compilation isn’t successful.

I suppose I’ll have to try from the command like you suggest. A bit annothing though, shouldn’t there be a way to see the compiler output when compiling from the editor? Even if not in the editor, at least in a log file somewhere?

Well UE4 is designed in the way it expects you have external editor and compile there.

Well I have an external editor, but I compile in the UE editor (since there’s a compile button), so all I need is a way to see the output the the editor would certainly be ABLE to show me if it felt like it. Guess I’ll just have to see if I can convince the UE editor to show me the compile output!

IF your editor is IDE, then if you set up compilation you should see output in external ide

I use vim, so that’s why I’d prefer to be able to just compile and see the output in UE4Editor. Though not a huge issue for me to compile via CLI if that works the same as pressing the button, the button is just more convenient.

So uh, where is UnrealBuildTool located? Can’t find a binary with that name or a make target with that name.

In Bineries in DotNET

ah thanks!

finally had a chance to give this a try and it is indeed working like a charm, thanks for the help! Where would i be able to find more info on how to use the UnrealBuildTool from the command line?

It’s undocumented, you need to hunt those from source code, you can see most of them starting from this point (scrool down and oyu will see more):

https://github.com/EpicGames/UnrealEngine/blob/5fd57546cc721650026801021de0be733d48a3e9/Engine/Source/Programs/UnrealBuildTool/System/UnrealBuildTool.cs#L520

YUou can also do build configuration in build scripts, per project (.Target.cs) and per module (.Build.cs"). Those are also lacking of docs (reather info about it spread accross diffrent pages), best way to learn what you can do with them is look in source code, since engine also have build scripts you can base on

ok, thanks a lot for your help!

I must say, as a newcomer to UE4 development, I’ve found a number of your comments and answers on a variety of UE4 AnswerHub questions very helpful. Thanks for making unreal engine easier to figure out and learn!

No Problem ^^

The accepted answer deploys the entire project, which is likely not what you want.

I’ve made a bash function you can add to your .bashrc that can be run like this:

cd /path/to/ProjectName
unrealbuild ./ProjectName.uproject

The forum post with the bash code is here: