UnrealBuildTool compiles my code when no changes have been made

UBT is in a strange state. I started seeing this problem with another project, so I created a clean First Person C++ project and am seeing the same thing. My setup is:

  • Visual Studio 2013
  • Unreal Engine 4.3 Source code checked out with GIT

I built the project and everything built fine with no errors. When the build finishes, I select build again (without making any other changes) and it builds the .cpp files in the Games folder again.

I can start the editor in the debugger and set breakpoints in the game files (GameMode, Character, etc) and they work. I then exit the editor, make a simple change (auto x = 3;) to GameMode::GameMode(), set a breakpoint on the new line and hit F5 to compile and start the debugger. When the editor launches, the breakpoint is never triggered and checking the editor window, the breakpoint is grayed out, suggestion the source and the game dll don’t match.

I’ve checked all the usual suspects, have lot’s of free disk space. Git shows that I haven’t made any changes to the source files, I’m baffled at this point, since this problem just started in the past 24 hours.

Anyone have any suggestons on how to debug this problem? How can I enable logging in UBT to see why it’s rebuilding these files and not reporting any errors? I’m not sure what else to try, short of reinstalling the source code and trying a clean install.

Update

Not sure how I missed this before, but when I run UBT as the startup project, I get several compile errors. But when I set the startup project to my game project, the compile errors are not there. This is still very strange as I use to get the compile errors in the Game Build. My non-UE4 projects are showing compile errors, so this is something related to UBT.

Output from UBT project is set as startup and run

Performing 10 actions (max 4 parallel jobs)
NewCouplingGameMode.cpp
NewCouplingCharacter.cpp
PCH.Coupling.CouplingPrivatePCH.h.cpp
NewCouplingHUD.cpp
NewCouplingProjectile.cpp
NewCoupling.cpp
d:\unreal\projects\research\newcoupling\plugins\coupling\source\coupling\public\V8Engine.h(43) : error C2143: syntax err
or : missing ';' before '<'
d:\unreal\projects\research\newcoupling\plugins\coupling\source\coupling\public\V8Engine.h(43) : error C4430: missing ty
pe specifier - int assumed. Note: C++ does not support default-int
d:\unreal\projects\research\newcoupling\plugins\coupling\source\coupling\public\V8Engine.h(44) : error C2334: unexpected
 token(s) preceding '{'; skipping apparent function body
-------- End Detailed Actions Stats -----------------------------------------------------------
ERROR: UBT ERROR: Failed to produce item: D:\Unreal\Projects\Research\NewCoupling\Plugins\Coupling\Binaries\Win64\UE4Edi
tor-Coupling-Win64-DebugGame.pdb
Cumulative action seconds (8 processors): 0.00 building projects, 4.84 compiling, 0.00 creating app bundles, 0.00 genera
ting debug info, 0.00 linking, 0.00 other
UBT execution time: 61.26 seconds

Output when NewCoupling2 project is set as startup and Build > Compile (F7) is clicked. Notice the lack of errors following NewCoupling2.cpp:

20>  Performing 6 actions (max 4 parallel jobs)
20>  NewCoupling2GameMode.cpp
20>  NewCoupling2HUD.cpp
20>  NewCoupling2Projectile.cpp
20>  NewCoupling2Character.cpp
20>  NewCoupling2.cpp
20>  [6/6] link.exe UE4Editor-NewCoupling2-Win64-DebugGame.dll
20>     Creating library D:\Unreal\Projects\Research\NewCoupling2\Intermediate\Build\Win64\NewCoupling2Editor\DebugGame\UE4Editor-NewCoupling2-Win64-DebugGame.lib and object D:\Unreal\Projects\Research\NewCoupling2\Intermediate\Build\Win64\NewCoupling2Editor\DebugGame\UE4Editor-NewCoupling2-Win64-DebugGame.exp
20>  -------- End Detailed Actions Stats -----------------------------------------------------------
20>  Cumulative action seconds (8 processors): 0.00 building projects, 1.93 compiling, 0.00 creating app bundles, 0.00 generating debug info, 0.69 linking, 0.00 other
20>  UBT execution time: 19.73 seconds
28>  Target is up to date.
========== Build: 2 succeeded, 0 failed, 1 up-to-date, 30 skipped ==========

Hi jCoder,

This is unusual. You could try debugging UnreaBuildTool to see what exactly happens. To do this, just set UBT in the project solution (under Programs folder) as the startup project and set its command line to the one you can find in the nmake section of your project settings (usually something like: ‘TargetName Configuration Platform ProjectPath’, for example: ‘MyGameEditor Development Win64 D:\MyProjects\MyGame\MyGame.uproject’.

One you have that, add a breakpoint in ActionGraph.cs, IsActionOutdated function and see what actions and why are out of date.

Hi Robert, See the update I added to my post.

If I understand correctly, it just silently fails when building the game project? Or does it think it succeeded?

You can see at the bottom of the game build that it reported 2 succeeded. If I tell it to start the debugger, it will build it, not report the error and then run the old game build. Any breakpoints set on the new code show as white (disabled) instead of red.

Did you try rebuilding UBT to fix the disabled breakpoints? Can you start debugging UBT with F11 (a.k.a. Debug → Step Into) to see if you can Debug UBT at all?

I had no problem debugging UBT, it was my game code that couldn’t be debugged, due to UBT not seeing the errors from the compiler. It would think the compile completed and launch the game, but the VS debugger was looking at the dll and seeing that it was older then the source code and so it wouldn’t set the breakpoints.

I’ve had some other issues with my computer (it’s 4 years old) like random hard lockups that have been affecting my work. So I just bought a new computer and will be moving dev over to that. I haven’t seen the issue anywhere else so I think it’s a one-off corruption, but if I see it again, I’ll update this.

Hi jCoder,
could you let us know if you need more help?