Linking Jolt with Makefile and Visual Studio Code #1483
Unanswered
eashaankumar
asked this question in
Q&A
Replies: 1 comment 2 replies
-
I'm not sure if libraries compiled with g++ through mingw are compatible with those compiled with CL (Visual Studio compiler). I would try compiling Jolt with Also there's a (big) chance that you have mismatching preprocessor defines. Compile Jolt using |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to add Jolt as a static library using Makefile.
I built the Jolt project with
cmake_vs2022_cl_double
and went into Visual Studio and ensured that the Jolt project was set to Static Library mode and Debug mode. The project built successfully and producedJolt.lib
andJolt.pbd
. I linked to these files in my Makefile with -l and used the correct libs path with -L (I think). But for some reason I keep gettingmingw32/bin/ld.exe: Undefined reference to JPH::Shape
and various other JPH classes. This is weird because this same Makefile has worked on other libraries such as vulkan, sdl2, glfw, etc. So can somebody tell me what I am doing wrong?Im on Windows and trying to develop in Visual Studio Code.
Makefile:
`
CXX = g++
CXXFLAGS = -std=c++23 -Wall -pedantic-errors -DDEBUG -g -Wno-unknown-pragmas
APP = test
SRCS = ${APP}/src/*.cpp
LIBSDIR = -LC:\Users\seana\dev\CppPrjs\CaraEngineDev\stoopid\dependencies\libs
LIBS = -lJolt
HEADERS = -IC:\Users\seana\dev\CppPrjs\JoltPhysics
app: ${APP}/src/*.cpp
${CXX} ${CXXFLAGS}
${HEADERS}
${SRCS}
-L/usr/local/lib -Lstdlib ${LIBSDIR} ${LIBS}
-o ${APP}
`
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\seana\AppData\Local\Temp\ccOk0QK4.o:main.cpp:(.rdata$.refptr._ZTVN3JPH5ShapeE[.refptr._ZTVN3JPH5ShapeE]+0x0): undefined reference to
vtable for JPH::Shape'c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\seana\AppData\Local\Temp\ccOk0QK4.o:main.cpp:(.rdata$.refptr._ZN3JPH5TraceE[.refptr._ZN3JPH5TraceE]+0x0): undefined reference to
JPH::Trace' c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\seana\AppData\Local\Temp\ccOk0QK4.o:main.cpp:(.rdata$.refptr._ZN3JPH4FreeE[.refptr._ZN3JPH4FreeE]+0x0): undefined reference to
JPH::Free'collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:14: app] Error 1`
Beta Was this translation helpful? Give feedback.
All reactions