グラム++でDLLのコンパイル: https://github.com/newhouseb/openvr-c私は++グラムとWindows上のこの挙コンパイルしようとしてきた
私のコマンドライン:私は2番目の行を実行すると
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
私はこれらのエラーを取得します:
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
私はこれらのエラーが何であるかを理解していない、
誰かが私を啓発することはできますか?
このプロジェクトは、OpenVRにCバインディングのセットです。 gccで構築されたOpenVRバージョンとリンクする必要があります。 –
OpenVRは閉鎖ソースで、私はそれがVisual Studioでビルドされていると思います。 私はバインディングをコンパイルする場合、私は同じコンパイラを使用する必要がありますか? – Tribes
はい、同じコンパイラを使用する必要があります。 g ++とVSは非常に異なるABIを持っています。名前のマングリングは異なります、オブジェクトのレイアウトは異なります、標準的なライブラリの実装はまったく異なっています... –