Linker Error after modifying Engine Source Code

Trying to add a function, “MyFun()”, to “BodyInstance.h” class. It would have similar functionality as “UpdateMassProperties()” so I used that implementation as a template.

Declaration in .h

Definition in .cpp

I call it in my custom class here

and get the following error (LNK2019)

Reading other posts, it I have tried a a clean rebuild by deleting “intermediate”, “saved”, “.vs”, “Binaries”, “MyProject.sln” and regenerating VS project files.

I have also made sure to include “Engine” and “PhysicsCore” in the Module Dependencies inside the “Build.cs” file.


This is quite a headache. Am I not including the right module dependency? Or am I missing step in the rebuild process? Any help is much appreciated --Thank You.

I’ve had VS not building files before - a quick way to test if it’s that is to add something like “sdfjkhsdf” to the cpp file and see if it generates an error. Sometimes for me, changing to debug and compiling then changing back fixes it, right clicking on the UE project and selecting rebuild all has fixed it other times. I’ve also had it magically compile by restarting my machine and rebuilding.

After some more digging, I think I needed to build Unreal Engine from source (github) instead of the build I had from the Epic Games Launcher. Apparently, the engine source files dont get rebuild if you installed from the launcher. I am testing this out and will report back once I can verify this. Thanks!

1 Like

I checked. This was totally the problem. Anyone else trying to edit the source files… actually download the source. Dont use the binary (aka from the EpicGames Launcher)