Error when compiling DirectionalLightComponent child class

I’m trying to create a sun with earth-accurate position and movement. I have the code I need from other projects and so i thought the best way to use it would be to create a child class of the DirectionalLightComponent and add the code in there. Is there a better way?

Assuming that’s the best route, I added code to the project through the editor, selected “Show all Classes”, and chose “DirectionalLightComponent”. Without any changes to the created files, Visual Studio gives me a number of similar errors when I build the project:

Error	1	error LNK2001: unresolved external symbol "public: virtual class FVector4 __cdecl UDirectionalLightComponent::GetLightPosition(void)const " (?GetLightPosition@UDirectionalLightComponent@@UEBA?AVFVector4@@XZ)	D:\Documents\MIT\7.Thesis\Unreal\sphereStepsV4\Intermediate\ProjectFiles\SunDirectionalLightComponent.cpp.obj	sphereStepsV4
Error	2	error LNK2001: unresolved external symbol "public: virtual class FVector4 __cdecl UDirectionalLightComponent::GetLightPosition(void)const " (?GetLightPosition@UDirectionalLightComponent@@UEBA?AVFVector4@@XZ)	D:\Documents\MIT\7.Thesis\Unreal\sphereStepsV4\Intermediate\ProjectFiles\sphereStepsV4.generated.cpp.obj	sphereStepsV4
Error	3	error LNK2001: unresolved external symbol "public: virtual enum ELightComponentType __cdecl UDirectionalLightComponent::GetLightType(void)const " (?GetLightType@UDirectionalLightComponent@@UEBA?AW4ELightComponentType@@XZ)	D:\Documents\MIT\7.Thesis\Unreal\sphereStepsV4\Intermediate\ProjectFiles\SunDirectionalLightComponent.cpp.obj	sphereStepsV4
Error	4	error LNK2001: unresolved external symbol "public: virtual enum ELightComponentType __cdecl UDirectionalLightComponent::GetLightType(void)const " (?GetLightType@UDirectionalLightComponent@@UEBA?AW4ELightComponentType@@XZ)	D:\Documents\MIT\7.Thesis\Unreal\sphereStepsV4\Intermediate\ProjectFiles\sphereStepsV4.generated.cpp.obj	sphereStepsV4
Error	5	error LNK2001: unresolved external symbol "public: virtual class FLightSceneProxy * __cdecl UDirectionalLightComponent::CreateSceneProxy(void)const " (?CreateSceneProxy@UDirectionalLightComponent@@UEBAPEAVFLightSceneProxy@@XZ)	D:\Documents\MIT\7.Thesis\Unreal\sphereStepsV4\Intermediate\ProjectFiles\SunDirectionalLightComponent.cpp.obj	sphereStepsV4
Error	6	error LNK2001: unresolved external symbol "public: virtual class FLightSceneProxy * __cdecl UDirectionalLightComponent::CreateSceneProxy(void)const " (?CreateSceneProxy@UDirectionalLightComponent@@UEBAPEAVFLightSceneProxy@@XZ)	D:\Documents\MIT\7.Thesis\Unreal\sphereStepsV4\Intermediate\ProjectFiles\sphereStepsV4.generated.cpp.obj	sphereStepsV4
Error	7	error LNK2001: unresolved external symbol "public: virtual void __cdecl UDirectionalLightComponent::PostEditChangeProperty(struct FPropertyChangedEvent &)" (?PostEditChangeProperty@UDirectionalLightComponent@@UEAAXAEAUFPropertyChangedEvent@@@Z)	D:\Documents\MIT\7.Thesis\Unreal\sphereStepsV4\Intermediate\ProjectFiles\SunDirectionalLightComponent.cpp.obj	sphereStepsV4
Error	8	error LNK2001: unresolved external symbol "public: virtual void __cdecl UDirectionalLightComponent::PostEditChangeProperty(struct FPropertyChangedEvent &)" (?PostEditChangeProperty@UDirectionalLightComponent@@UEAAXAEAUFPropertyChangedEvent@@@Z)	D:\Documents\MIT\7.Thesis\Unreal\sphereStepsV4\Intermediate\ProjectFiles\sphereStepsV4.generated.cpp.obj	sphereStepsV4
Error	9	error LNK2001: unresolved external symbol "public: virtual bool __cdecl UDirectionalLightComponent::CanEditChange(class UProperty const *)const " (?CanEditChange@UDirectionalLightComponent@@UEBA_NPEBVUProperty@@@Z)	D:\Documents\MIT\7.Thesis\Unreal\sphereStepsV4\Intermediate\ProjectFiles\SunDirectionalLightComponent.cpp.obj	sphereStepsV4
Error	10	error LNK2001: unresolved external symbol "public: virtual bool __cdecl UDirectionalLightComponent::CanEditChange(class UProperty const *)const " (?CanEditChange@UDirectionalLightComponent@@UEBA_NPEBVUProperty@@@Z)	D:\Documents\MIT\7.Thesis\Unreal\sphereStepsV4\Intermediate\ProjectFiles\sphereStepsV4.generated.cpp.obj	sphereStepsV4
Error	11	error LNK2001: unresolved external symbol "public: virtual void __cdecl UDirectionalLightComponent::Serialize(class FArchive &)" (?Serialize@UDirectionalLightComponent@@UEAAXAEAVFArchive@@@Z)	D:\Documents\MIT\7.Thesis\Unreal\sphereStepsV4\Intermediate\ProjectFiles\SunDirectionalLightComponent.cpp.obj	sphereStepsV4
Error	12	error LNK2001: unresolved external symbol "public: virtual void __cdecl UDirectionalLightComponent::Serialize(class FArchive &)" (?Serialize@UDirectionalLightComponent@@UEAAXAEAVFArchive@@@Z)	D:\Documents\MIT\7.Thesis\Unreal\sphereStepsV4\Intermediate\ProjectFiles\sphereStepsV4.generated.cpp.obj	sphereStepsV4
Error	13	error LNK2001: unresolved external symbol "public: virtual void __cdecl UDirectionalLightComponent::InvalidateLightingCacheDetailed(bool,bool)" (?InvalidateLightingCacheDetailed@UDirectionalLightComponent@@UEAAX_N0@Z)	D:\Documents\MIT\7.Thesis\Unreal\sphereStepsV4\Intermediate\ProjectFiles\SunDirectionalLightComponent.cpp.obj	sphereStepsV4
Error	14	error LNK2001: unresolved external symbol "public: virtual void __cdecl UDirectionalLightComponent::InvalidateLightingCacheDetailed(bool,bool)" (?InvalidateLightingCacheDetailed@UDirectionalLightComponent@@UEAAX_N0@Z)	D:\Documents\MIT\7.Thesis\Unreal\sphereStepsV4\Intermediate\ProjectFiles\sphereStepsV4.generated.cpp.obj	sphereStepsV4
Error	15	error LNK1120: 7 unresolved externals	D:\Documents\MIT\7.Thesis\Unreal\sphereStepsV4\Binaries\Win64\UE4Editor-sphereStepsV4.dll	sphereStepsV4
Error	16	error : Failed to produce item: D:\Documents\MIT\7.Thesis\Unreal\sphereStepsV4\Binaries\Win64\UE4Editor-sphereStepsV4.dll	D:\Documents\MIT\7.Thesis\Unreal\sphereStepsV4\Intermediate\ProjectFiles\ERROR	sphereStepsV4
Error	17	error MSB3073: The command ""C:\Program Files\Unreal Engine\4.5\Engine\Build\BatchFiles\Rebuild.bat" sphereStepsV4Editor Win64 Development "D:\Documents\MIT\7.Thesis\Unreal\sphereStepsV4\sphereStepsV4.uproject" -rocket" exited with code 2.	C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets	43	5	sphereStepsV4

Looking at “Components/DirectionalLightComponent.h”, it looks like there’s an error for each virtual method of DirectionalLightComponent. I get no errors when I build the project after creating a regular Actor class in the editor.

According to this question, which seems possibly similar, I need the parent virtual functions to be in the vTable of my derived class. Here’s where my C++ knowledge ends, and I have no idea how to do that. I also don’t see why that would be a problem with DirectionalLightComponent and not the regular Actor.