I’m trying to add some physics-related functionality to CapsuleComponent. Unfortunately, I’ve run into a few snags with this. I went into the class browser, found CapsuleComponent, right-clicked, and chose “add new C++ class” (wording may be off, but it’s the obvious one). Typed in name of new component, went into MSVC, and tried to build a completely bare new class.
And I get a massive pile of unresolved-external-symbol errors:
Error 1 error LNK2001: unresolved external symbol "public: virtual void __cdecl UShapeComponent::GetUsedMaterials(class TArray<class UMaterialInterface *,class FDefaultAllocator> &)const " (?GetUsedMaterials@UShapeComponent@@UEBAXAEAV?$TArray@PEAVUMaterialInterface@@VFDefaultAllocator@@@@@Z) C:\werk\starclock\Intermediate\ProjectFiles\ShipPhysicsComponent.cpp.obj Starclock
Error 2 error LNK2001: unresolved external symbol "public: virtual class UBodySetup * __cdecl UShapeComponent::GetBodySetup(void)" (?GetBodySetup@UShapeComponent@@UEAAPEAVUBodySetup@@XZ) C:\werk\starclock\Intermediate\ProjectFiles\ShipPhysicsComponent.cpp.obj Starclock
Error 3 error LNK2001: unresolved external symbol "public: virtual void __cdecl UCapsuleComponent::Serialize(class FArchive &)" (?Serialize@UCapsuleComponent@@UEAAXAEAVFArchive@@@Z) C:\werk\starclock\Intermediate\ProjectFiles\ShipPhysicsComponent.cpp.obj Starclock
Error 4 error LNK2001: unresolved external symbol "public: virtual void __cdecl UCapsuleComponent::PostEditChangeProperty(struct FPropertyChangedEvent &)" (?PostEditChangeProperty@UCapsuleComponent@@UEAAXAEAUFPropertyChangedEvent@@@Z) C:\werk\starclock\Intermediate\ProjectFiles\ShipPhysicsComponent.cpp.obj Starclock
Error 5 error LNK2001: unresolved external symbol "public: virtual struct FBoxSphereBounds __cdecl UCapsuleComponent::CalcBounds(class FTransform const &)const " (?CalcBounds@UCapsuleComponent@@UEBA?AUFBoxSphereBounds@@AEBVFTransform@@@Z) C:\werk\starclock\Intermediate\ProjectFiles\ShipPhysicsComponent.cpp.obj Starclock
Error 6 error LNK2001: unresolved external symbol "public: virtual void __cdecl UCapsuleComponent::CalcBoundingCylinder(float &,float &)const " (?CalcBoundingCylinder@UCapsuleComponent@@UEBAXAEAM0@Z) C:\werk\starclock\Intermediate\ProjectFiles\ShipPhysicsComponent.cpp.obj Starclock
Error 7 error LNK2001: unresolved external symbol "public: virtual class FPrimitiveSceneProxy * __cdecl UCapsuleComponent::CreateSceneProxy(void)" (?CreateSceneProxy@UCapsuleComponent@@UEAAPEAVFPrimitiveSceneProxy@@XZ) C:\werk\starclock\Intermediate\ProjectFiles\ShipPhysicsComponent.cpp.obj Starclock
Error 8 error LNK2001: unresolved external symbol "public: virtual bool __cdecl UCapsuleComponent::IsZeroExtent(void)const " (?IsZeroExtent@UCapsuleComponent@@UEBA_NXZ) C:\werk\starclock\Intermediate\ProjectFiles\ShipPhysicsComponent.cpp.obj Starclock
Error 9 error LNK2001: unresolved external symbol "public: virtual struct FCollisionShape __cdecl UCapsuleComponent::GetCollisionShape(float)const " (?GetCollisionShape@UCapsuleComponent@@UEBA?AUFCollisionShape@@M@Z) C:\werk\starclock\Intermediate\ProjectFiles\ShipPhysicsComponent.cpp.obj Starclock
Error 10 error LNK2001: unresolved external symbol "public: virtual bool __cdecl UCapsuleComponent::AreSymmetricRotations(class FQuat const &,class FQuat const &,class FVector const &)const " (?AreSymmetricRotations@UCapsuleComponent@@UEBA_NAEBVFQuat@@0AEBVFVector@@@Z) C:\werk\starclock\Intermediate\ProjectFiles\ShipPhysicsComponent.cpp.obj Starclock
Error 11 error LNK2001: unresolved external symbol "public: virtual void __cdecl UCapsuleComponent::UpdateBodySetup(void)" (?UpdateBodySetup@UCapsuleComponent@@UEAAXXZ) C:\werk\starclock\Intermediate\ProjectFiles\ShipPhysicsComponent.cpp.obj Starclock
Error 12 error LNK1120: 11 unresolved externals C:\werk\starclock\Binaries\Win64\UE4Editor-Starclock.dll Starclock
I’m guessing it’s trying to find the base UCapsuleComponent functions, but being unable to because my dll isn’t being linked properly with whatever defines those functions. It is, however, not clear to me how to fix this. I don’t want to change those functions - I want them to behave exactly like they already do - so somehow, I need for that link to work.
How can I get this to link properly, to make a subclass of CapsuleComponent that is - at least at the moment - identical to CapsuleComponent?