Tribes
Tribes

Reputation: 35

Compiling a dll with g++

I've been trying to compile this projet on windows with g++: https://github.com/newhouseb/openvr-c

My command lines:

g++ -c  -std=gnu++0x -DBUILDING_OPENVR_C openvr_c.cpp openvr_c.h
g++ -shared -o openvr_c.dll openvr_c.o  -std=gnu++0x -Wl,--out-implib,openvr_api.dll -L. -lopenvr_api

When i run the second line i get these errors:

openvr_c.o:openvr_c.cpp:(.text$_ZN2vr14COpenVRContext10CheckClearEv[__ZN2vr14COpenVRContext10CheckClearEv]+0x12): undefined reference to _imp__VR_GetInitToken' openvr_c.o:openvr_c.cpp:(.text$_ZN2vr14COpenVRContext10CheckClearEv[__ZN2vr14COpenVRContext10CheckClearEv]+0x33): undefined reference to_imp__VR_GetInitToken' openvr_c.o:openvr_c.cpp:(.text$_ZN2vr14COpenVRContext8VRSystemEv[__ZN2vr14COpenVRContext8VRSystemEv]+0x2b): undefined reference to _imp__VR_GetGenericInterface' openvr_c.o:openvr_c.cpp:(.text$_ZN2vr14COpenVRContext11VRChaperoneEv[__ZN2vr14COpenVRContext11VRChaperoneEv]+0x2c): undefined reference to_imp__VR_GetGenericInterface' openvr_c.o:openvr_c.cpp:(.text$_ZN2vr14COpenVRContext16VRChaperoneSetupEv[__ZN2vr14COpenVRContext16VRChaperoneSetupEv]+0x2c): undefined reference to _imp__VR_GetGenericInterface' openvr_c.o:openvr_c.cpp:(.text$_ZN2vr14COpenVRContext12VRCompositorEv[__ZN2vr14COpenVRContext12VRCompositorEv]+0x2c): undefined reference to_imp__VR_GetGenericInterface' openvr_c.o:openvr_c.cpp:(.text$_ZN2vr14COpenVRContext9VROverlayEv[__ZN2vr14COpenVRContext9VROverlayEv]+0x2c): undefined reference to _imp__VR_GetGenericInterface' openvr_c.o:openvr_c.cpp:(.text$_ZN2vr14COpenVRContext14VRRenderModelsEv[__ZN2vr14COpenVRContext14VRRenderModelsEv]+0x2c): more undefined references to_imp__VR_GetGenericInterface' follow openvr_c.o:openvr_c.cpp:(.text$_ZN2vr7VR_InitEPNS_12EVRInitErrorENS_18EVRApplicationTypeE[__ZN2vr7VR_InitEPNS_12EVRInitErrorENS_18EVRApplicationTypeE]+0x23): undefined reference to _imp__VR_InitInternal' openvr_c.o:openvr_c.cpp:(.text$_ZN2vr7VR_InitEPNS_12EVRInitErrorENS_18EVRApplicationTypeE[__ZN2vr7VR_InitEPNS_12EVRInitErrorENS_18EVRApplicationTypeE]+0x4c): undefined reference to_imp__VR_IsInterfaceVersionValid' openvr_c.o:openvr_c.cpp:(.text$_ZN2vr7VR_InitEPNS_12EVRInitErrorENS_18EVRApplicationTypeE[__ZN2vr7VR_InitEPNS_12EVRInitErrorENS_18EVRApplicationTypeE]+0x61): undefined reference to _imp__VR_ShutdownInternal' openvr_c.o:openvr_c.cpp:(.text$_ZN2vr11VR_ShutdownEv[__ZN2vr11VR_ShutdownEv]+0x7): undefined reference to_imp__VR_ShutdownInternal' collect2.exe: error: ld returned 1 exit status

I don't understand what are these errors,

Can someone enlighten me ?

Upvotes: 2

Views: 6414

Answers (1)

Ivan Rubinson
Ivan Rubinson

Reputation: 3329

This looks like a lot of errors coming from your linker. Make sure you link to your dependencies properly.

What is an undefined reference/unresolved external symbol error and how do I fix it?

Upvotes: 0

Related Questions