Adding a cable component to a custom code class will result in a build failure in Visual Studio unless the Cable Component's source code is modified to include CABLECOMPONENT_API.
PrivateDependencyModuleNames.AddRange(new string[] { "CableComponent" }); PrivateIncludePathModuleNames.AddRange(new string[] { "CableComponent" });
#include "CableComponent.h" UPROPERTY(Category = "Cable", EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true")) UCableComponent* cable;
RESULT:
The build fails with the following LNK2019 error message:
error LNK2019: unresolved external symbol "private: static class UClass * __cdecl UCableComponent::GetPrivateStaticClass(wchar_t const *)" (?GetPrivateStaticClass@UCableComponent@@CAPEAVUClass@@PEB_W@Z) referenced in function "public: class UCableComponent * __cdecl FObjectInitializer::CreateDefaultSubobject<class UCableComponent>(class UObject *,class FName,bool)const " (??$CreateDefaultSubobject@VUCableComponent@@@FObjectInitializer@@QEBAPEAVUCableComponent@@PEAVUObject@@VFName@@_N@Z)
EXPECTED:
The project builds successfully.
WORKAROUND:
In the CableComponent.h file, change the line class UCableComponent : public UMeshComponent to class CABLECOMPONENT_API UCableComponent : public UMeshComponent
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-15620 in the post.
1 |
Component | UE - Gameplay |
---|---|
Affects Versions | 4.7.6, 4.9 |
Target Fix | 4.8 |
Created | May 14, 2015 |
---|---|
Resolved | May 15, 2015 |
Updated | Apr 27, 2018 |