Hi everyone,
I want to create a child class of the ULevel class contained in Unreal Engine source code (I’m testing on 4.27/5.0 and 5.1 codebases).
At first, creating a class like
UCLASS()
class DEMOPROJECT_API UMyLevel : public ULevel
Generate a lot of linking errors (28) like :
error LNK2001: unresolved external symbol "public: virtual void __cdecl ULevel::Serialize(class FArchive &)" (?Serialize@ULevel@@UEAAXAEAVFArchive@@@Z)
I read on another forum post that it’s because of the minimalApi parameters in the UCLASS macro of ULevel. I removed it and added ENGINE_API to the class as I read on another forum post.
UCLASS()
class ENGINE_API ULevel : public UObject, public IInterface_AssetUserData, public ITextureStreamingContainer
With that in class, I got an error messages telling me that members of the ULevel class with ENGINE_API cannot have that ENGINE_API macro if the class itself already has it.
Error C2487 'Serialize': member of dll interface class may not be declared with dll interface
I removed all ENGINE_API for all the methods that are contained in the ULevel class but I still get three errors :
error C2487: 'GetPrivateStaticClass': member of dll interface class may not be declared with dll interface
error C2487: 'Serialize': member of dll interface class may not be declared with dll interface
error C2487: 'ULevel::{ctor}': member of dll interface class may not be declared with dll interface
From what I see, these methods seems to have generated by the GENERATED_BODY macro and they seems to have ENGINE_API.
My questions are :
- Is there a way to remove those ENGINE_API from the generated code by the generated body macro (parameters/config…) ?
- Is it possible / allowed to inherit from ULevel ? If so, is there a simpler way to do it ?
Thanks,