Unresolved external symbol: inheriting from URadialForceComponent

This question was already posted at the forums but I’m hoping to find answers here since this looks like an engine problem.

After inheriting from URadialForceComponent and trying to compile, I ended up with several unresolved external symbol errors.

[.h]

#pragma once

#include "PhysicsEngine/RadialForceComponent.h"
#include "SF_RadialForceComponent.generated.h"

/**
 * 
 */
UCLASS()
class SHOOTERGAME_API USF_RadialForceComponent : public URadialForceComponent
{
	GENERATED_BODY()

	
};

[.cpp]

#include "ShooterGame.h"
#include "SF_RadialForceComponent.h"

Compiling this gives me a set of errors:

1>Module.ShooterGame.1_of_3.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl URadialForceComponent::FireImpulse(void)" (?FireImpulse@URadialForceComponent@@UEAAXXZ)
1>ShooterGame.generated.1.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl URadialForceComponent::FireImpulse(void)" (?FireImpulse@URadialForceComponent@@UEAAXXZ)
1>ShooterGame.generated.2.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl URadialForceComponent::FireImpulse(void)" (?FireImpulse@URadialForceComponent@@UEAAXXZ)
1>Module.ShooterGame.1_of_3.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl URadialForceComponent::AddObjectTypeToAffect(class TEnumAsByte<enum EObjectTypeQuery>)" (?AddObjectTypeToAffect@URadialForceComponent@@UEAAXV?$TEnumAsByte@W4EObjectTypeQuery@@@@@Z)
1>ShooterGame.generated.1.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl URadialForceComponent::AddObjectTypeToAffect(class TEnumAsByte<enum EObjectTypeQuery>)" (?AddObjectTypeToAffect@URadialForceComponent@@UEAAXV?$TEnumAsByte@W4EObjectTypeQuery@@@@@Z)
1>ShooterGame.generated.2.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl URadialForceComponent::AddObjectTypeToAffect(class TEnumAsByte<enum EObjectTypeQuery>)" (?AddObjectTypeToAffect@URadialForceComponent@@UEAAXV?$TEnumAsByte@W4EObjectTypeQuery@@@@@Z)
1>Module.ShooterGame.1_of_3.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl URadialForceComponent::RemoveObjectTypeToAffect(class TEnumAsByte<enum EObjectTypeQuery>)" (?RemoveObjectTypeToAffect@URadialForceComponent@@UEAAXV?$TEnumAsByte@W4EObjectTypeQuery@@@@@Z)
1>ShooterGame.generated.1.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl URadialForceComponent::RemoveObjectTypeToAffect(class TEnumAsByte<enum EObjectTypeQuery>)" (?RemoveObjectTypeToAffect@URadialForceComponent@@UEAAXV?$TEnumAsByte@W4EObjectTypeQuery@@@@@Z)
1>ShooterGame.generated.2.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl URadialForceComponent::RemoveObjectTypeToAffect(class TEnumAsByte<enum EObjectTypeQuery>)" (?RemoveObjectTypeToAffect@URadialForceComponent@@UEAAXV?$TEnumAsByte@W4EObjectTypeQuery@@@@@Z)
1>Module.ShooterGame.1_of_3.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl URadialForceComponent::TickComponent(float,enum ELevelTick,struct FActorComponentTickFunction *)" (?TickComponent@URadialForceComponent@@MEAAXMW4ELevelTick@@PEAUFActorComponentTickFunction@@@Z)
1>ShooterGame.generated.1.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl URadialForceComponent::TickComponent(float,enum ELevelTick,struct FActorComponentTickFunction *)" (?TickComponent@URadialForceComponent@@MEAAXMW4ELevelTick@@PEAUFActorComponentTickFunction@@@Z)
1>ShooterGame.generated.2.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl URadialForceComponent::TickComponent(float,enum ELevelTick,struct FActorComponentTickFunction *)" (?TickComponent@URadialForceComponent@@MEAAXMW4ELevelTick@@PEAUFActorComponentTickFunction@@@Z)
1>Module.ShooterGame.1_of_3.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl URadialForceComponent::BeginPlay(void)" (?BeginPlay@URadialForceComponent@@MEAAXXZ)
1>ShooterGame.generated.1.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl URadialForceComponent::BeginPlay(void)" (?BeginPlay@URadialForceComponent@@MEAAXXZ)
1>ShooterGame.generated.2.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl URadialForceComponent::BeginPlay(void)" (?BeginPlay@URadialForceComponent@@MEAAXXZ)
1>Module.ShooterGame.1_of_3.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl URadialForceComponent::PostLoad(void)" (?PostLoad@URadialForceComponent@@MEAAXXZ)
1>ShooterGame.generated.1.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl URadialForceComponent::PostLoad(void)" (?PostLoad@URadialForceComponent@@MEAAXXZ)
1>ShooterGame.generated.2.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl URadialForceComponent::PostLoad(void)" (?PostLoad@URadialForceComponent@@MEAAXXZ)
1>Module.ShooterGame.1_of_3.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl URadialForceComponent::PostEditChangeProperty(struct FPropertyChangedEvent &)" (?PostEditChangeProperty@URadialForceComponent@@MEAAXAEAUFPropertyChangedEvent@@@Z)
1>ShooterGame.generated.1.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl URadialForceComponent::PostEditChangeProperty(struct FPropertyChangedEvent &)" (?PostEditChangeProperty@URadialForceComponent@@MEAAXAEAUFPropertyChangedEvent@@@Z)
1>ShooterGame.generated.2.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl URadialForceComponent::PostEditChangeProperty(struct FPropertyChangedEvent &)" (?PostEditChangeProperty@URadialForceComponent@@MEAAXAEAUFPropertyChangedEvent@@@Z)

I’m using UE4 version 4.15.

After doing some research, I found a 2 year-old Answerhub thread with exactly the same error, but with no clear solutions.

Any thoughts? Thanks.

Hi ,

The reason that you are getting these errors is because URadialForceComponent is missing ENGINE_API in its declaration. Simply add that tag and remove the MinimalAPI meta data tag to get it to compile successfully.

EDIT: I created a PR that addresses this issue #3346.

Cheers,

Thanks.

Strangely, it did not compiled succesfully, giving me these errors:

1>D:\Epic Games\UE_4.15\Engine\Source\Runtime\Engine\Classes\PhysicsEngine/RadialForceComponent.h(18): error C2487: 'GetPrivateStaticClass': member of dll interface class may not be declared with dll interface
1>D:\Epic Games\UE_4.15\Engine\Source\Runtime\Engine\Classes\PhysicsEngine/RadialForceComponent.h(18): error C2487: 'URadialForceComponent::{ctor}': member of dll interface class may not be declared with dll interface

Did you manage to compile it?

I did a full recompile on the engine, and it completed without issues :S .

Created a clean project to test this.

At first I compiled the whole solution, and it was sucessfull:

========== Rebuild All: 2 succeeded, 0 failed, 0 skipped ==========

Then, I did the changings at RadialForceComponent.h as suggested, and after compilling it gave me this:

2>D:\Epic Games\UE_4.15\Engine\Source\Runtime\Engine\Classes\PhysicsEngine/RadialForceComponent.h(18): error C2487: 'GetPrivateStaticClass': member of dll interface class may not be declared with dll interface
2>D:\Epic Games\UE_4.15\Engine\Source\Runtime\Engine\Classes\PhysicsEngine/RadialForceComponent.h(18): error C2487: 'URadialForceComponent::{ctor}': member of dll interface class may not be declared with dll interface
2>ERROR : UBT error : Failed to produce item: D:\UnrealEngineProjects\RadCompBlank\Binaries\Win64\UE4Editor-RadCompBlank.dll
2>  Total build time: 71,15 seconds (Local executor: 0,00 seconds)
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(46,5): error MSB3073: The command ""D:\Epic Games\UE_4.15\Engine\Build\BatchFiles\Rebuild.bat" RadCompBlankEditor Win64 Development "D:\UnrealEngineProjects\RadCompBlank\RadCompBlank.uproject" -waitmutex" exited with code -1.
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========

How did you manage to make this work? :o