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
How does TextureRenderTarget2D get TArray<uint8> type data?
Why does the REMOVE method of map container remove elements have memory leaks?
How do I set a material as a post-processing material?
How to delete some elements correctly when deleting an array loop?
What is the cause of the packaging error falling back to 'GameUserSettings' in ue5?
What controls of umg have mouse wheel events in UE4.27?
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 |