0
\$\begingroup\$

I got some link errors when extending UBatchLineComponent this way:

UCLASS(MinimalAPI)
class UPBLineBatchComponent : public ULineBatchComponent
{
    GENERATED_UCLASS_BODY()
public:
    virtual void UpdateBounds();
    virtual FBoxSphereBounds CalcBounds(const FTransform& LocalToWorld) const override;
    void SetTransform(const FTransform &Transform);
    FBoxSphereBounds LocalBounds;
};

It gave me those errors:

Error   5   error LNK2001: unresolved external symbol "public: virtual class FPrimitiveSceneProxy * __cdecl ULineBatchComponent::CreateSceneProxy(void)" (?CreateSceneProxy@ULineBatchComponent@@UEAAPEAVFPrimitiveSceneProxy@@XZ)  C:\Users\Yvain\Documents\ProBuilder\Intermediate\ProjectFiles\Module.ProBuilderPlugin.2_of_2.cpp.obj    ProBuilder
Error   6   error LNK2001: unresolved external symbol "public: virtual class FPrimitiveSceneProxy * __cdecl ULineBatchComponent::CreateSceneProxy(void)" (?CreateSceneProxy@ULineBatchComponent@@UEAAPEAVFPrimitiveSceneProxy@@XZ)  C:\Users\Yvain\Documents\ProBuilder\Intermediate\ProjectFiles\ProBuilderPlugin.generated.cpp.obj    ProBuilder
Error   9   error LNK2001: unresolved external symbol "public: virtual void __cdecl ULineBatchComponent::ApplyWorldOffset(struct FVector const &,bool)" (?ApplyWorldOffset@ULineBatchComponent@@UEAAXAEBUFVector@@_N@Z) C:\Users\Yvain\Documents\ProBuilder\Intermediate\ProjectFiles\Module.ProBuilderPlugin.2_of_2.cpp.obj    ProBuilder
Error   10  error LNK2001: unresolved external symbol "public: virtual void __cdecl ULineBatchComponent::ApplyWorldOffset(struct FVector const &,bool)" (?ApplyWorldOffset@ULineBatchComponent@@UEAAXAEBUFVector@@_N@Z) C:\Users\Yvain\Documents\ProBuilder\Intermediate\ProjectFiles\ProBuilderPlugin.generated.cpp.obj    ProBuilder
Error   1   error LNK2001: unresolved external symbol "public: virtual void __cdecl ULineBatchComponent::DrawLine(struct FVector const &,struct FVector const &,struct FLinearColor const &,unsigned char,float,float)" (?DrawLine@ULineBatchComponent@@UEAAXAEBUFVector@@0AEBUFLinearColor@@EMM@Z) C:\Users\Yvain\Documents\ProBuilder\Intermediate\ProjectFiles\Module.ProBuilderPlugin.2_of_2.cpp.obj    ProBuilder
Error   2   error LNK2001: unresolved external symbol "public: virtual void __cdecl ULineBatchComponent::DrawLine(struct FVector const &,struct FVector const &,struct FLinearColor const &,unsigned char,float,float)" (?DrawLine@ULineBatchComponent@@UEAAXAEBUFVector@@0AEBUFLinearColor@@EMM@Z) C:\Users\Yvain\Documents\ProBuilder\Intermediate\ProjectFiles\ProBuilderPlugin.generated.cpp.obj    ProBuilder
Error   3   error LNK2001: unresolved external symbol "public: virtual void __cdecl ULineBatchComponent::DrawPoint(struct FVector const &,struct FLinearColor const &,float,unsigned char,float)" (?DrawPoint@ULineBatchComponent@@UEAAXAEBUFVector@@AEBUFLinearColor@@MEM@Z)   C:\Users\Yvain\Documents\ProBuilder\Intermediate\ProjectFiles\Module.ProBuilderPlugin.2_of_2.cpp.obj    ProBuilder
Error   4   error LNK2001: unresolved external symbol "public: virtual void __cdecl ULineBatchComponent::DrawPoint(struct FVector const &,struct FLinearColor const &,float,unsigned char,float)" (?DrawPoint@ULineBatchComponent@@UEAAXAEBUFVector@@AEBUFLinearColor@@MEM@Z)   C:\Users\Yvain\Documents\ProBuilder\Intermediate\ProjectFiles\ProBuilderPlugin.generated.cpp.obj    ProBuilder
Error   7   error LNK2001: unresolved external symbol "public: virtual void __cdecl ULineBatchComponent::TickComponent(float,enum ELevelTick,struct FActorComponentTickFunction *)" (?TickComponent@ULineBatchComponent@@UEAAXMW4ELevelTick@@PEAUFActorComponentTickFunction@@@Z)   C:\Users\Yvain\Documents\ProBuilder\Intermediate\ProjectFiles\Module.ProBuilderPlugin.2_of_2.cpp.obj    ProBuilder
Error   8   error LNK2001: unresolved external symbol "public: virtual void __cdecl ULineBatchComponent::TickComponent(float,enum ELevelTick,struct FActorComponentTickFunction *)" (?TickComponent@ULineBatchComponent@@UEAAXMW4ELevelTick@@PEAUFActorComponentTickFunction@@@Z)   C:\Users\Yvain\Documents\ProBuilder\Intermediate\ProjectFiles\ProBuilderPlugin.generated.cpp.obj    ProBuilder
\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

ULineBatchComponent is not fully-exported out of the engine module, so you can't subclass it like that (the symbols you are getting link errors for are not tagged with ENGINE_API, so they don't get exported, so they cannot be found at link time).

A better solution to this problem is to create your own component that delegates to a ULineBatchComponent member for all functionality except that which you're trying to alter (based on your other question, this is the bounding box computation).

You could also modify the engine source code to expose the type (remove ENGINE_API from all members of ULineBatchComponent and added it to the class itself, remove MinimalAPI from the UCLASS macro). This is probably a recipe for long-term pain, though.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .