Closed Mahmoud1205 closed 1 month ago
I've not seen this error before and e.g. JPH::ConvexShape::RestoreBinaryState
is a regular function that doesn't depend on any preprocessor macro. The only thing I can say with the information given is that most likely you have a mismatch in compiler/linker options between the lib and your own project. E.g. maybe you're compiling Jolt as a shared lib and linking it as a regular lib?
I didn't change any of the options while compiling, I'm using Visual Studio 2022, I'm linking it by adding the directory its (Jolt.lib) in to the Library Directories property in VS22 since I thought that was enough. But now that I added "Jolt.lib" to Properties > Linker > Input > Additional Dependencies theres new errors, theyre all just "mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MD_DynamicRelease' in glm.obj" repeated dozens of time, and the file doing it is Jolt.lib. Can I not use GLM alongside Jolt? And there are dozens of "unresolved external symbol _CrtDbgReport" and some other stuff, all coming from Jolt.lib... Also, compiling and running the samples in the Jolt solution works fine, so the issue is with my project setup.
As the error says: You're mixing runtime libraries. Jolt by default uses statically linked runtime libraries, to switch to dynamic (which your project appears to be using) set the USE_STATIC_MSVC_RUNTIME_LIBRARY cmake option while compiling Jolt to OFF.
Here are the first 3 errors: LNK2001 unresolved external symbol "protected: virtual void cdecl JPH::ConvexShape::RestoreBinaryState(class JPH::StreamIn &)" LNK2001 unresolved external symbol "bool (cdecl JPH::AssertFailed)(char const ,char const ,char const ,unsigned int)" LNK2001 unresolved external symbol "private: static struct JPH::PhysicsLock::LockData * JPH::PhysicsLock::sLocks"
I'm using the Debug config and I have JPH_ENABLE_ASSERTS and JPH_DEBUG_RENDERER defined in the preprocessor, and Jolt.lib is in the linker inputs. The answer to https://github.com/jrouwe/JoltPhysics/issues/987 did not help me.