Unresolved external, unreal project inoperable

Hello I was doing the following steps:

class MY_API MyMenu
{

  public:

    void HandleMenu( class ArtsHUD* in_HUD );

};

void MyMenu::HandleMenu
(
  class ArtsHUD* in_HUD
)
{
    FLinearColor color = FLinearColor::White;
    in_rtsHUD->DrawRect( color, 100.0f, 100.0f, 100.0f, 100.0f );
}

Everthing works fine, project is OK. If I delete Binaries and Intermediate stuff, The UEditor is able to recover everthing from the myproject.uproject file. I am using git for source controll only the significant files.

But if I turn the code into how DrawRect is implemented internally in canvas.cpp (to make use of rotation):

void MyMenu::HandleMenu
(
  class ArtsHUD* in_HUD
)
{
  FLinearColor color = FLinearColor::Blue;
  color.A = 0.3f;

  //in_rtsHUD->DrawRect( color, 100.0f, 100.0f, 100.0f, 100.0f );

  FCanvasTileItem TileItem( FVector2D( 100.0f, 100.0f ),
     GWhiteTexture, FVector2D( 100.0f, 100.0f ), color );

  TileItem.BlendMode = SE_BLEND_Translucent;
  TileItem.Rotation = FRotator( .0f, 90.0f, .0f );
  in_rtsHUD->Canvas->DrawItem( TileItem );
}

After a long coding session … I was always using “DebugGame” configuration, everthing works fine…

But back in UEditor, suddenly I am facing a bunch of build problems. UEditor says, it cannot compile. The Unreal Project looks to be completly ruined, all my work for the trash? It took me hours to figure out whats the particular matter.

The causing issue is an unresolved external of GWhiteTexture if I compile with “DebugGame Editor”:

MyMenu.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class FTexture * GWhiteTexture" (__imp_?GWhiteTexture@@3PEAVFTexture@@EA)

I didn’t realize that “DebugGame” and “DebugGame Editor”, somehow, has different dependencies. Is this a bug?

Does someone has an idea how to fix this glitch ?

I wouldn’t expect the editor and game to have the same set of dependencies however what you’re saying seems the opposite to what I’d expect (the standalone game to include less).

Personally I’ve put textures for general C++ access in a singleton texture manager. They are the accessible from different parts of code.

The textures themselves are embedded in game actors (for instance my derived from AGameMode class). Code is attached - you are welcome to use it but use at your own risk.

In class MyGameMode : public AGameMode…

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Data)
		TArray<FTextureCollection> TextureCollections;

TextureCollectionManager *mp_TextureCollections = 0;

In the CPP (MyGameMode::InitGame)

mp_TextureCollections = new TextureCollectionManager;
		for (auto &collection : TextureCollections)
		{
			collection.InitMap();
			if (!collection.CollectionName.IsEmpty())
			{
				mp_TextureCollections->AddCollection(collection);
			}
		}

And access (excuse the const_cast) by CollectionName:TextureName

pSnakeHead = const_cast<UTexture*>(TextureCollectionManager::GetInstance().GetTexture(_T("Snake:Head")));

Probably not very helpful, but here if you want it.

link text
link text

Thanks for the reply. :slight_smile:
OK, the idea is to use a workaround by substitution of “GWhiteTexture” from the engine resource with an own Texture object been hold somehow in an own resource manager. Sooner or later I have to implement a resource manager. Thanks for the code sample!