Download

Baffled: adding UFUNCTION() causes undeclared external symbol

Hey gang,
Completely baffled as to why adding a UFUNCTION() to a .h function signature causes it to trigger an unresolved external symbol error on compile:


 Creating library C:\UnrealProjects\FromBeyond\NeonDrift\Intermediate/Build/Win64\UE4Editor\DebugGame\UE4Editor-NeonDrift-Win64-DebugGame.lib and object C:\UnrealProjects\FromBeyond\NeonDrift\Intermediate/Build/Win64\UE4Editor\DebugGame\UE4Editor-NeonDrift-Win64-DebugGame.exp
2>Pawn_DefaultCar.cpp.obj : error LNK2019: unresolved external symbol "protected: void __cdecl APawn_DefaultCar::NeonInput_GetRPMAccelFromThrottle(float)" (?NeonInput_GetRPMAccelFromThrottle@APawn_DefaultCar@@IEAAXM@Z) referenced in function "public: void __cdecl APawn_DefaultCar::execNeonInput_GetRPMAccelFromThrottle(struct FFrame &,void * const)" (?execNeonInput_GetRPMAccelFromThrottle@APawn_DefaultCar@@QEAAXAEAUFFrame@@QEAX@Z)
2>NeonDrift.generated.cpp.obj : error LNK2001: unresolved external symbol "protected: void __cdecl APawn_DefaultCar::NeonInput_GetRPMAccelFromThrottle(float)" (?NeonInput_GetRPMAccelFromThrottle@APawn_DefaultCar@@IEAAXM@Z)

This is the sig in question, note it is not implemented in the cpp file yet:


UFUNCTION(BlueprintCallable, meta = (DisplayName = "Get RPM Accel From Throttle", Keywords = "rpm throttle neon float", Category = NeonInput))
		void NeonInput_GetRPMAccelFromThrottle(float throttleValue);

Once I comment out the UFUNCTION stuff, it’s fine.

Has anyone experienced this or have a clue as to what might cause it?

Thank you!

Figured it out, needed to have the implementation of the function in the cpp file… right… (duh)

yeah, C++ is a beast on its own right :P, and yep, you need the header files (where you share things) and the implementation files (atually you can code in the header… but with inline… and is a bad practice… and… well like I have said C++ is its own beast)