How can I inherit a class from AGameplayCameraActor in C++?

I’m trying to inherit a class from AGameplayCameraActor, but I’m getting the following errors:

  • LNK2001: unresolved external symbol “public: virtual void __cdecl AGameplayCameraActorBase::CalcCamera(float,struct FMinimalViewInfo &)” (?CalcCamera@AGameplayCameraActorBase@@UEAAXMAEAUFMinimalViewInfo@@@Z)
  • LNK2001: unresolved external symbol “public: virtual void __cdecl AGameplayCameraActorBase::CalcCamera(float,struct FMinimalViewInfo &)” (?CalcCamera@AGameplayCameraActorBase@@UEAAXMAEAUFMinimalViewInfo@@@Z)
  • LNK2001: unresolved external symbol "public: virtual class USceneComponent * __cdecl AGameplayCameraActor::GetDefaultAttachComponent(void)const " (?GetDefaultAttachComponent@AGameplayCameraActor@@UEBAPEAVUSceneComponent@@XZ)
  • LNK2001: unresolved external symbol "public: virtual class USceneComponent * __cdecl AGameplayCameraActor::GetDefaultAttachComponent(void)const " (?GetDefaultAttachComponent@AGameplayCameraActor@@UEBAPEAVUSceneComponent@@XZ)
  • LNK2001: unresolved external symbol "protected: virtual class UGameplayCameraComponentBase * __cdecl AGameplayCameraActor::GetCameraComponentBase(void)const " (?GetCameraComponentBase@AGameplayCameraActor@@MEBAPEAVUGameplayCameraComponentBase@@XZ)
  • LNK2001: unresolved external symbol "protected: virtual class UGameplayCameraComponentBase * __cdecl AGameplayCameraActor::GetCameraComponentBase(void)const " (?GetCameraComponentBase@AGameplayCameraActor@@MEBAPEAVUGameplayCameraComponentBase@@XZ)

I’ve already included GameplayCameras in my project’s build.cs file.

AGameplayCameraActor
GameplayCameras

Thank you!

Unfortunately none of those functions are marked for DLL export (the XXXX_API macro).

This means that even with the module listed in your build.cs, the linker doesn’t know that those functions have a definition available.

If you are building the Engine from source, you could edit those headers and add the GAMEPLAYCAMERAS_API macro in front of each function.

If you’re using an engine installed from the launcher you could reimplement all those functions as overrides of your derived class. This should work as long as you don’t call Super:: versions of any functions. All the functions look pretty trivial. The trickiest one would be AGameplayCameraActorBase::CalcCamera but that just calls Super::CalcCamer so your implementation could be to call AActor::CalcCamera directly from your implementation.
(this is also an option if you’re using a source build depending on how you and your team treat engine source modifications)

1 Like