Linker error creating my own SceneCaptureComponents2D class

Hi i am trying to make my own class deriving from SceneCaptureComponent2D using:
#include “Components/SceneCaptureComponent2D.h”
and then i have:
#include “CaptureComponent2D.generated.h”

UCLASS()
class UCaptureComponent2D : public USceneCaptureComponent2D
{
GENERATED_UCLASS_BODY()

};

I feel like i am missing a step that is not obvious. i am trying to use this in creating a mini-map and feel a little lost. the way i understand it a basic class creation like this should work as i have it working for a SceneCapture2D class with no problems.

P.S my error reads:
Error 1 error LNK2019: unresolved external symbol “public: static void __cdecl USceneCaptureComponent::AddReferencedObjects(class UObject *,class FReferenceCollector &)” (?AddReferencedObjects@USceneCaptureComponent@@SAXPEAVUObject@@AEAVFReferenceCollector@@@Z) referenced in function “void __cdecl GetPrivateStaticClassBody(wchar_t const *,wchar_t const ,class UClass * &,void (__cdecl)(void))” (??$GetPrivateStaticClassBody@VUCaptureComponent2D@@@@YAXPEB_W0AEAPEAVUClass@@P6AXXZ@Z)

this error has admittedly morphed into something else and am now getting linker errors about not being able to find functions from the inherited class USceneCaptureComponent2D despite that i explicitly show the class where to find it. i have no problems inheriting from other classes just this one seems to give me trouble…any help would be appreciated.

Hello, mrdid456

I am sorry to hear about your issue.

To fix it please add ENGINE_API macro before declarations of following methods:

  1. PostLoad(), AddReferencedObjects() in SceneCaptureComponent.h;

  2. SendRenderTransform_Concurrent(), RequiresGameThreadEndOfFrameUpdates(), TickComponent(), PostEditChangeProperty(), UpdateContent() and UpdateDeferredCaptures() in SceneCaptureComponent2D.h.

Hope this helped!

Good luck!

Hi Andrii,

I’m using UE version 4.13.2 and I’m experiencing the same problem as mrdid456. Seems to me that these macro should be added to the engine so that users like myself do not need to create modifications to the engine that need to be merged everytime we upgrade UE. I see that UE 4.17 was just released. Can you tell me if these changes have been applied to any engine version after 4.13.2?

Regards,