[英]Compiling a dll with g++
I've been trying to compile this projet on windows with g++: https://github.com/newhouseb/openvr-c 我一直试图用g ++在windows上编译这个项目: 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 :(文本$ _ZN2vr14COpenVRContext10CheckClearEv [__ ZN2vr14COpenVRContext10CheckClearEv] + 0×12):未定义参照_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 :(文本$ _ZN2vr14COpenVRContext8VRSystemEv [__ ZN2vr14COpenVRContext8VRSystemEv] + 0x2B访问):未定义参照_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 :(文本$ _ZN2vr14COpenVRContext16VRChaperoneSetupEv [__ ZN2vr14COpenVRContext16VRChaperoneSetupEv] + 0x2c上):未定义参照_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
openvr_c.o:openvr_c.cpp :(文本$ _ZN2vr14COpenVRContext9VROverlayEv [__ ZN2vr14COpenVRContext9VROverlayEv] + 0x2c上):未定义参照_imp__VR_GetGenericInterface' openvr_c.o:openvr_c.cpp:(.text$_ZN2vr14COpenVRContext14VRRenderModelsEv[__ZN2vr14COpenVRContext14VRRenderModelsEv]+0x2c): more undefined references to
_imp__VR_GetGenericInterface '遵循openvr_c.o:openvr_c.cpp :(文本$ _ZN2vr7VR_InitEPNS_12EVRInitErrorENS_18EVRApplicationTypeE [__ ZN2vr7VR_InitEPNS_12EVRInitErrorENS_18EVRApplicationTypeE] + 0×23):未定义参照_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):对_imp__VR_ShutdownInternal' openvr_c.o:openvr_c.cpp:(.text$_ZN2vr11VR_ShutdownEv[__ZN2vr11VR_ShutdownEv]+0x7): undefined reference to
未定义引用_imp__VR_ShutdownInternal' openvr_c.o:openvr_c.cpp:(.text$_ZN2vr11VR_ShutdownEv[__ZN2vr11VR_ShutdownEv]+0x7): 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_imp__VR_ShutdownInternal' openvr_c.o:openvr_c.cpp:(.text$_ZN2vr11VR_ShutdownEv[__ZN2vr11VR_ShutdownEv]+0x7): undefined reference to
_imp__VR_ShutdownInternal'collect2.exe的_imp__VR_ShutdownInternal' openvr_c.o:openvr_c.cpp:(.text$_ZN2vr11VR_ShutdownEv[__ZN2vr11VR_ShutdownEv]+0x7): undefined reference to
:错误:ld返回1退出状态
I don't understand what are these errors, 我不明白这些错误是什么,
Can someone enlighten me ? 有人可以开导我吗?
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? 什么是未定义的引用/未解析的外部符号错误,我该如何解决?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.