MinGW linking error

Is there a way to use PhysX with MinGW?

I’m currently trying but I get a linking error:

obj/Test.o:Test.cpp:(.text+0x2e4): undefined reference to `physx::PxDefaultErrorCallback::~PxDefaultErrorCallback()'
obj/Test.o:Test.cpp:(.text+0x32d): undefined reference to `physx::PxDefaultErrorCallback::PxDefaultErrorCallback()'

My command line:

g++ -Llib -obin/Test.exe obj/Test.o -lopengl32 -lfreeglut -lglu32 -lPhysX3_x86 -lPhysX3Common_x86 -lPhysX3Extensions -lPhysXProfileSDK -lPhysX3Extensions

And finally my code: http://pastebin.com/aL5yBCgj

How do I fix this linking issue? I really don’t want to switch to MSVC.


The PhysX Android(ARM) binaries can be built with MinGW, so it should also work for x86.
PxDefaultErrorCallback should be in PhysX3Extensions.

  • Check that you built PhysX3Extensions and that it is in the search path (source available).
  • Use -Wl,--start-group YOUR_LIBS -Wl,--end-group to frame your -l list. This resolves interdependencies between the libraries.
  • Stefan Duthaler


Thank you for your answer.

PhysX3Extensions.lib is in search path and nm found the constructor and destructor. The --start-group is a great idea but dosen’t fix this problem.

I got another idea: I just wrote an own simple error callback. It compiled! But if I start the program, it crashes with exit code -1073741819.

How do I fix this issue?

Found the error: the MinGW ABI may be incompatible with the libraries. Moved discussion to https://devtalk.nvidia.com/default/topic/532922/physx-and-physics-modeling/mingw-libraries/