Description

If a TextureRenderTarget2D is used in a code class, the build of the project will fail with an error stating that the UTextureRenderTarget base class is undefined. The line #include "Engine/TextureRenderTarget.h" needs to be added to TextureRenderTarget2D.h in order to build the project.

Steps to Reproduce
  1. Create a new project using the First Person Code template.
  2. Build the project in Visual Studio.
  3. Open the project in the Editor.
  4. Add a new code class to the project derived from AHUD.
  5. In the header file add the following include: #include "Engine/TextureRenderTarget2D.h"
  6. In the class section of the header file, add the following lines:
    	virtual void DrawHUD() override;
    	
    	UTextureRenderTarget2D* MiniMapTex;
    
  7. In the .cpp file add the following code:
    #include "CanvasItem.h"
    
    void AMyHUD::DrawHUD()
    {
    	Super::DrawHUD();
    
    	FVector2D MiniMapDrawPosition(0, 0);
    
    	FCanvasTileItem MiniMapTileItem(MiniMapDrawPosition, MiniMapTex->Resource, FLinearColor::White);
    }
    
  8. Build the project in Visual Studio.

RESULTS:
The build fails with the following error:

1>D:\Main-Builds\UE4\Engine\Source\Runtime\Engine\Classes\Engine/TextureRenderTarget2D.h(17): error C2504: 'UTextureRenderTarget' : base class undefined

EXPECTED:
The build completes successfully.

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

0
Login to Vote

Fixed
ComponentUE - Foundation - Core
Target Fix4.6
Fix Commit2357022
Release Commit2357022
CreatedNov 5, 2014
ResolvedNov 12, 2014
UpdatedFeb 5, 2017