Problems compiling classes that inherit from Texture.h

Hey guys,

i’m a newb when it comes to programing UE. I’m having problems with compiling new classes created from Texture Parent Class. Anything else works fine, but when trying to compile Texture derived clases i get errors:

CompilerResultsLog:Error: Error Texture2DArray.cpp.obj : error LNK2019: unresolved external symbol “__declspec(dllimport) public: __cdecl FRenderCommandFence::~FRenderCommandFence(void)” (_imp??1FRenderCommandFence@@QEAA@XZ) referenced in function “public: virtual __cdecl UTexture2DArray::~UTexture2DArray(void)” (??1UTexture2DArray@@UEAA@XZ)

CompilerResultsLog:Error: Error TextureArrays.generated.cpp.obj : error LNK2001: unresolved external symbol “__declspec(dllimport) public: __cdecl FRenderCommandFence::~ (void)” (_imp??1FRenderCommandFence@@QEAA@XZ)

CompilerResultsLog:Error: Error Texture2DArray.cpp.obj : error LNK2019: unresolved external symbol “__declspec(dllimport) public: virtual __cdecl FTextureReference::~FTextureReference(void)” (_imp??1FTextureReference@@UEAA@XZ) referenced in function “public: virtual __cdecl UTexture2DArray::~UTexture2DArray(void)” (??1UTexture2DArray@@UEAA@XZ)

CompilerResultsLog:Error: Error TextureArrays.generated.cpp.obj : error LNK2001: unresolved external symbol “__declspec(dllimport) public: virtual __cdecl FTextureReference::~FTextureReference(void)” (_imp??1FTextureReference@@UEAA@XZ)
CompilerResultsLog:Error: Error C:\Users\Jacek\Documents\Unreal Projects\TextureArrays\Binaries\Win64\UE4Editor-TextureArrays-264.dll : fatal error LNK1120: 2 unresolved externals

I’m not sure, but i think this worked before (like yesterday). Since then i’ve reinstalled the engine with no luck.

I’m on UE4.11.

the compilation gives this error even during c++ class creation.

Anyone can help?

The UTexture based classes are all specified as MinimalAPI, this stops those symbols from being exported, so you won’t be able to inherit from them outside of the module they’re created in (the Engine module in this case).

You could do your own build of the unreal from source and put your class in the engine module. I’d expect this would fix your issue, but I’m not certain, so others may want to chime in with corrections.

Edit: Another option, which I have just tried and has things compiling (but I don’t yet have a full implementation to say is definitely what you want), is to inherit from UTexture2DDynamic. It’s also marked MinimalAPI, so I don’t know what about it is different that ensures it has needed symbols available. Some of the functions are exported as part of the ENGINE_API, but not all the ones that are marked as missing when inheriting from UTexture2D are there.

If somebody knows what’s happening here, I’d be interested in the details.

The first option would probably work, but since i’d like to implement Texture2DArray support this would not work on vanilla UE. Also i dont know if You can create a plugin that would alter the core engine.

I believe that functions not marked with ENGINE_API export successfully if they are defined in the header. The docs also mention that MinimalAPI inline methods can still be called, I assume this means that inline methods are also exported but I don’t actually know if this is true.

Hi, I don’t know or my answer will still be relevant to your problem, but recently they wrote something about a similar problem at https://businessays.net/category/marketing/. If you are still interested, then look in the Blog section of the site, maybe it will be useful to you.

programming is a complex discipline that has many functions and classes. To understand all this and make a good game for users, you need to be a professional. usually programmers are people with a technical mind. they are well versed in technology and documentation but are completely unable to sort out their thoughts on paper. to write a thesis, programmers turn to https://pro-papers.com/pay-to-do-my-coursework
for help.

Hey, I just encountered and solved a similar problem with inheriting from UVolumeTexture.

The solution was to simply reimplement all the unexported functions in your inherited class.

I copypasted all of them from VolumeTexture.cpp, replaced all Super:: calls with UTexture:: calls and commented out one or two things that were not linkable, but not too important.

I’ll post a link to my repo later this week.