Unresolved symbol then inherit from UTexture2D

Hi,

if I try to inherit a class from UTexture2D I got unresolved symbol

MyTexture2D.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UTexture2D::Serialize(class FArchive &)" (?Serialize@UTexture2D@@UEAAXAEAVFArchive@@@Z)
MyTexture2D.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UTexture2D::PostLinkerChange(void)" (?PostLinkerChange@UTexture2D@@UEAAXXZ)

First of all, I thought, well maybe I missed the “Engine” and/or “CoreUObject” module in PublicDependencyModuleNames / PrivateDependencyModuleNames in the Build.cs file. But no. Both are added,

I guess one module is still missing, But how should I figure it out, if the online documentation only points me to the “Engine” and “CoreUObject” module?

What is my error?

UTexture2d is marked as MinimalAPI - try removing that and recompiling the engine, then seeing if you can subclass it?
I’ve seen that affect the ability of one module to see classes defined in others.

https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Reference/Classes/Specifiers/MinimalAPI/index.html

thx I will try it.

But in the end, I think I need to find another way to implement a custom texture for my plugin. Maybe I need to go step higher in the class hierarchy and inherit directly from UTexture.

UTexture has the same problem, to use it you would need to remove MinimalApi and add ENGINE_API in front of the class definition.

Okay, thx for the feedback. That I got/learned from you:
0) It is not possible to extend/implement a new texture class for a plugin, based on a binary engine build.

  1. I got a deeper understanding for the UE4 documentation.

Thx.

This may have changed since a year ago, but I don’t think MinimalApi has to do with this.

While UTexture, UTexture2D, and even UTexture2DDynamic all have the MinimalApi flag, you can inherit from UTexture and UTexture2DDynamic just fine. UTexture2D seems to be the only one causing linker errors.

The ENGINE_API notion seems to be correct though. UTexture has all the necessary functions prefixed with ENGINE_API so you can extend it. But UTexture2D removes the prefix from its functions when it overrides them, so you get the linker errors.