Can't compile CPP Code with FVehicleGearData's constructor in it.

I’d like to create a way to modify the cars in-game (not by the users) with config files. I made a FCarConfig structure with everything I need and it works fine but I cannot call the FVehicleGearData’s constructor. (Or I think that’s the compiler’s problem.)

Here’s a code which takes in my FGear struct, which is very similiar to the FVehicleGearData but allows Blueprints to access it.

FVehicleGearData ATP_VehicleAdvPawn::CreateGearData(FGear gear)
	FVehicleGearData g;
	g.DownRatio = gear.DownRatio;
	g.UpRatio = gear.UpRatio;
	g.Ratio = gear.GearRation;
	return g;
for (auto& gear : cfg.Gears)

Without these parts of the code, it compiles just fine.

And this is the error message I get:

TP_VehicleAdvPawn.cpp.obj : error LNK2019: unresolved external symbol "public: __cdecl FVehicleGearData::FVehicleGearData(void)" (??0FVehicleGearData@@QEAA@XZ) referenced in function "public: struct FVehicleGearData __cdecl ATP_VehicleAdvPawn::CreateGearData(struct FGear)" (?CreateGearData@ATP_VehicleAdvPawn@@QEAA?AUFVehicleGearData@@UFGear@@@Z)

I have no idea what I’m doing wrong.
Thank you for your help and time!

Without the text of the error it would be pretty difficult to guess at :slight_smile:

Any idea?

Do you have the PhysXVehicles plugin enabled?


looking more closely into the header files, the FVehicleGearData is private, it looks like you’ll probably need to grab a FVehicleTransmissionData to contain it, as that’s in the public API

Make Sure this list:

  • Enable “PhysXVehicles” plugin in your project file.
  • Add module dependencey: Add “PhysXVehicles” to your game build file.
  • Regenerate VisualStudio or XCode project files

ah, yes, making sure that it’s linked in the .Build.cs is a pretty good idea too.

The problem is the FVehicleGearData struct (in fact and many other structures from the plugin PhysXVehicles) isn’t marked as PHYSXVEHICLES_API.