Compil error while adding custom GameViewportClient

Hi

When I am trying to add a custom GameViewportClient with “add code to project” section, I have a compil error in visual

It says that UEngine is undefined.

'…\Epic Games\4.6\Engine\Source\Runtime\CoreUObject\Public\UObject\Class.h(2244): error C2027: use of undefined type 'UEngine

. …\Epic Games\4.6\Engine\Source\Runtime\Engine\Classes\Engine/GameViewportClient.h(54) : see declaration of 'UEngine

. …\Documents\Unreal Projects\MyProject19\Intermediate\Build\Win64\Inc\MyProject19\MyProject19.generated.cpp(14) : see reference to function template instantiation ‘void GetPrivateStaticClassBody(const TCHAR *,const TCHAR *,UClass *&,void (__cdecl *)(void))’ being compiled’

I added a custom cameraManager or PlayerController, it works perfectly, only the GameViewportClient is not wokring.
Does anyone has any clues how to resolve it ?

Thanks
Cheers

Hi
I think you have to include Engine.h file in your project header file.

hi, thank you for your answer…

Just popping into say I ran into this earlier today. If you try and extend certain sample projects that use “EngineMinimal.h” instead of “Engine.h” this error will occur.

Hope Epic will see this as those using C++ samples as a starting point or learning tool will be left REALLY frustrated when they try to extend something like GameViewportClient.

As JonTerp pointed you should include Engine.h in your “.h” file instead of “EngineMinimal.h”.

Eveything will work then.