Crash at PxCreatePhysics with error "Foundation: Invalid registration detected"

Hi all,

I encounter the same problem as in this thread:
“Unhandled exception when creating physics”

When I run my program under Debug config, it crashes at PxCreatePhysics, in particular in function Foundation::incRefCount() in file PsFoundation.cpp. It seems to me that this function expects mRefCount to be over 0, but this is not the case and it shows an error “Foundation: Invalid registration detected”.
This doesn’t happen under Release config. In fact, the above thread’s poster claimed likewise, but s/he just switched to Release and considered it solved. As I want to fix it under Debug too, does anyone have any idea how I can do it?

I use PhysX 3.3.4, Windows 8.1, Visual Studio 2013.
I tried a few code variations, including one that is similar to the initialisation in PhysXSample.cpp.


Sorry, my bad…I mistakenly linked a Release library to the Debug project. Linking the Debug library solves the problem.