4.15 C++ Transition Guide

I ran into this, and needed to add the MoviePlayer (or maybe MovieScene? I’m not at that computer right now) module dependency alongside LevelSequence.

Method for reading value of Sequencer track changed. Anybody knows where I should look for Eval() replacement?


((UMovieSceneColorTrack*)Track)->Eval(Frame / 30, 0, Color);

Isn’t it enabled by default?

This was indeed an issue and it is the correct fix for that error (still having problems with other things tho)

It is enabled by default only for engine plugins/modules for now.

Manually enabling is done via the flag in Builld.cs, right?

Yes. bEnforceIWYU = false disables new rules

Wait, shouldn’t that ENABLE it?

            /// <summary>
	/// Enforce "include what you use" rules when PCHUsage is set to ExplicitOrSharedPCH; warns when monolithic headers (Engine.h, UnrealEd.h, etc...) 
	/// are used, and checks that source files include their matching header first.
	/// </summary>
	public bool bEnforceIWYU = true;

In ModuleRules.cs

It is active for engine plugins and not active for projects by default. It turns out that the flag should be inverted

Ah, finally got it. It turns out I had to explicitly say PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;

Edit:

Alright, so that took a while. I had to move my #include “MyGame.h” as the second include for every .cpp file instead of the first. I had a bunch of other issues related to the fact that I had a “MyGameGeneral” log category defined in MyGame.h and now half of my files didn’t see it anymore. The thing is - I now don’t even have CoreMinimal.h included in MyGame.h - it’s a completely empty header file as far as includes go. All I have in it are some #define’s to name some collision channels.

For what it’s wort up until now my game was doing 4 tasks to compile, now it’s doing 3. I never had a bunch of issues with game compile times, I guess I’ll have to test it out a bit more.

Edit 2:

One curious thing I can’t quite figure out regarding the new bEnforceIWYU mode - how do you access GEngine without including Engine.h? I have my own GameplayStatics version and I need GEngine->GetWorldFromContextObject().

Do you use PCH file in this project (with errors) ? My GAME project (not engine module) was compiled without any issues. I use PCH files and multiple modules. I have noticed a significant compile time reduction for my project. Compile time for engine has increased.

If you integrated Boost into your project, you’ll get a long series of C4103 errors when you attempt to migrate your project to 4.15. If you’re looking to disable the error (since it’s a pragma warning turned error), you can remove 4103 from line 25 in your engine’s WindowsPlatformCompilerSetup.h, but you should reference what “#pragma pack” does first to know the warning/error you’re disabling.

I solved all of my errors, it was just a bunch of missing includes, now that I have to include everything manually. I’ve set PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; in my game’s Build.cs so it ought to be using them. The only thing I am still unclear about as mentioned before is how to reference GEngine without including Engine.h.

It seems hot reloading behaves oddly in 4.15?

Compiling my code while UE4 is running results in a build error:


1>ERROR : UBT error : Failed to produce item: D:\Unreal Projects\MyProject\Binaries\Win64\UE4Editor-MyProject-4280.dll
1>  Total build time: 34.24 seconds (Local executor: 0.00 seconds)
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(37,5): error MSB3075: The command ""C:\Program Files\Epic Games\UE_4.15\Engine\Build\BatchFiles\Build.bat" MyProjectEditor Win64 Development "D:\Unreal Projects\MyProject\MyProject.uproject" -waitmutex" exited with code 5. Please verify that you have sufficient rights to run this command.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

However despite the failed build and error, the Unreal Editor still updates properly with the new game code.
It looks like MyProjectEditor module could have something to do with it. Any ideas?

Having the same issues where it does hot reload but throws the error in Visual Studio. If you rebuild without the editor open their are no errors.


2>     Creating library D:\Documents\Unreal Projects\RPG_4_15\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-RPG_4_15-6083.lib and object D:\Documents\Unreal Projects\RPG_4_15\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-RPG_4_15-6083.exp
2>     Creating library D:\Documents\Unreal Projects\RPG_4_15\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-RPG_4_15-6083.suppressed.lib and object D:\Documents\Unreal Projects\RPG_4_15\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-RPG_4_15-6083.suppressed.exp
2>ERROR : UBT error : Failed to produce item: D:\Documents\Unreal Projects\RPG_4_15\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-RPG_4_15-8614.lib
2>  Total build time: 5.25 seconds (Local executor: 0.00 seconds)
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(37,5): error MSB3075: The command ""D:\ProgramFiles\Epic Games\UE_4.15\Engine\Build\BatchFiles\Build.bat" RPG_4_15Editor Win64 Development "D:\Documents\Unreal Projects\RPG_4_15\RPG_4_15.uproject" -waitmutex" exited with code 5. Please verify that you have sufficient rights to run this command.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I have problem: “Couldn’t find parent type for ‘OST_WheeledVehicle’ named ‘AWheeledVehicle’ in current module or any other module parsed so far.” Can someone help please?
Looks like problem in my OST_Character.h


1>------ Сборка начата: проект: UE4, Конфигурация: BuiltWithUnrealBuildTool Win32 ------
2>------ Сборка начата: проект: OST_Game, Конфигурация: Development_Editor x64 ------
2>  Creating makefile for hot reloading OST_GameEditor (no existing makefile)
2>  Compiling game modules for hot reload
2>  Performing full C++ include scan (no include cache file)
2>  Parsing headers for OST_GameEditor
2>    Running UnrealHeaderTool "C:\Users\Anna\Documents\Unreal Projects\OST_Game\OST_Game.uproject" "C:\Users\Anna\Documents\Unreal Projects\OST_Game\Intermediate\Build\Win64\OST_GameEditor\Development\OST_GameEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
2>EXEC : error : Couldn't find parent type for 'OST_WheeledVehicle' named 'AWheeledVehicle' in current module or any other module parsed so far.
2>C:/Users/Anna/Documents/Unreal Projects/OST_Game/Source/OST_Game/OST_Character.h(365): error : Unrecognized type 'AWheeledVehicle' - type must be a UCLASS, USTRUCT or UENUM
2>EXEC : error : UnrealHeaderTool failed for target 'OST_GameEditor' (platform: Win64, module info: C:\Users\Anna\Documents\Unreal Projects\OST_Game\Intermediate\Build\Win64\OST_GameEditor\Development\OST_GameEditor.uhtmanifest, exit code: OtherCompilationError (5)).
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(37,5): error MSB3075: Выход из команды ""Z:\Epic Games\UE_4.15\Engine\Build\BatchFiles\Build.bat" OST_GameEditor Win64 Development "C:\Users\Anna\Documents\Unreal Projects\OST_Game\OST_Game.uproject" -waitmutex" с кодом 5. Убедитесь в наличии достаточных прав для выполнения данной команды.
========== Сборка: успешно: 1, с ошибками: 1, без изменений: 0, пропущено: 0 ==========

I use plugin DonNavigation.
When I upgrade to 4.15, there are some errors:


1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(53): error C2065: 'FILETIME': undeclared identifier
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(53): error C2146: syntax error: missing ';' before identifier 'ft'
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(53): error C2065: 'ft': undeclared identifier
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(54): error C2065: 'LARGE_INTEGER': undeclared identifier
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(54): error C2146: syntax error: missing ';' before identifier 'li'
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(54): error C2065: 'li': undeclared identifier
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(58): error C2065: 'ft': undeclared identifier
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(58): error C3861: 'GetSystemTimeAsFileTime': identifier not found
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(59): error C2065: 'li': undeclared identifier
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(59): error C2228: left of '.LowPart' must have class/struct/union
1>  f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(59): note: type is 'unknown-type'
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(59): error C2065: 'ft': undeclared identifier
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(59): error C2228: left of '.dwLowDateTime' must have class/struct/union
1>  f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(59): note: type is 'unknown-type'
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(60): error C2065: 'li': undeclared identifier
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(60): error C2228: left of '.HighPart' must have class/struct/union
1>  f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(60): note: type is 'unknown-type'
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(60): error C2065: 'ft': undeclared identifier
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(60): error C2228: left of '.dwHighDateTime' must have class/struct/union
1>  f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(60): note: type is 'unknown-type'
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(62): error C2065: 'li': undeclared identifier
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(62): error C2228: left of '.QuadPart' must have class/struct/union
1>  f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(62): note: type is 'unknown-type'
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(53): error C2065: 'FILETIME': undeclared identifier
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(53): error C2146: syntax error: missing ';' before identifier 'ft'
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(53): error C2065: 'ft': undeclared identifier
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(54): error C2065: 'LARGE_INTEGER': undeclared identifier
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(54): error C2146: syntax error: missing ';' before identifier 'li'
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(54): error C2065: 'li': undeclared identifier
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(58): error C2065: 'ft': undeclared identifier
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(58): error C3861: 'GetSystemTimeAsFileTime': identifier not found
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(59): error C2065: 'li': undeclared identifier
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(59): error C2228: left of '.LowPart' must have class/struct/union
1>  f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(59): note: type is 'unknown-type'
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(59): error C2065: 'ft': undeclared identifier
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(59): error C2228: left of '.dwLowDateTime' must have class/struct/union
1>  f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(59): note: type is 'unknown-type'
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(60): error C2065: 'li': undeclared identifier
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(60): error C2228: left of '.HighPart' must have class/struct/union
1>  f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(60): note: type is 'unknown-type'
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(60): error C2065: 'ft': undeclared identifier
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(60): error C2228: left of '.dwHighDateTime' must have class/struct/union
1>  f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(60): note: type is 'unknown-type'
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(62): error C2065: 'li': undeclared identifier
1>f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(62): error C2228: left of '.QuadPart' must have class/struct/union
1>  f:\projects
vr\flyerfighting-trunk\plugins\donainavigation\source\donainavigation\classes\DonNavigationCommon.h(62): note: type is 'unknown-type'

It looks like it can’t recognize some types: “FILETIME”, “LARGE_INTEGER”…etc.
How do I modify the including rule to make proper build?

An Interface requires these headers with IWYU:


#include "UObject/ObjectMacros.h"
#include "UObject/Interface.h"

Also to get the Viewport size without GEngine, I have found that this works if you have access to the Player Controller pointer:



ULocalPlayer* Player = Cast<ULocalPlayer>(PlayerController->Player);

if (!Player) { return false; }
if (!Player->ViewportClient) { return false; }

//Viewport Center
FVector2D ViewportSize;
Player->ViewportClient->GetViewportSize(ViewportSize);


We are talking about this. Most of the thread is talking about this =x.

4.15 introduced IWYU (Include what you use) when it comes to header includes. The PCH file isn’t used anymore, and the new first header should be the filename.h.

As an example, if you create a new UObject subclass and are referencing and utilizing Actor or Controller pointers, you need to include GameFramework/Actor.h and GameFramework/Controller.h

Yeah, I noticed after reading the end of the release notes and putting two and two together, even though there was no strict mention fo the error I got, so I didn’t put two and two together at first (Hence why I deleted my post)…but my problem still stands. Does this mean I’m forced to change all the code in every single plug in I didn’t make to follow these new regulations? Is there no tool to place the primary header up top for all files?