opentk / rift

Cross-platform Oculus Rift bindings for .Net and Mono
26 stars 9 forks source link

sdk0.3.x build errors for Windows #5

Open murrdpirate opened 10 years ago

murrdpirate commented 10 years ago

I just downloaded the sdk0.3.x zip and am trying to build the solution. At first, I got errors for all of the .cpp/.h files in src because the EOL format was for Mac/Linux, so I changed the format of these files with notepad++.

Then I got errors in OVR_CAPI_GL.h and CAPI_GL_Util.h about glext.h and wglext.h not being found, so I just pasted those files into the same directory.

Now I'm getting errors about unresolved external symbols and a missing OculusCamera.cs file. Errors are copied below:

Error 1 unresolved external symbol "public: static class OVR::CAPI::DistortionRenderer * cdecl OVR::CAPI::D3D9::DistortionRenderer::Create(struct ovrHmdStruct ,class OVR::CAPI::FrameTimeManager &,class OVR::CAPI::HMDRenderState const &)" (?Create@DistortionRenderer@D3D9@CAPI@OVR@@SAPAV134@PAUovrHmdStruct@@AAVFrameTimeManager@34@ABVHMDRenderState@34@@Z) [C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\obj\x86\Debug\OVR.vcxproj] C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\CAPI_DistortionRenderer.obj OpenTK.Rift Error 2 unresolved external symbol "public: static class OVR::CAPI::DistortionRenderer * __cdecl OVR::CAPI::D3D11::DistortionRenderer::Create(struct ovrHmdStruct ,class OVR::CAPI::FrameTimeManager &,class OVR::CAPI::HMDRenderState const &)" (?Create@DistortionRenderer@D3D11@CAPI@OVR@@SAPAV134@PAUovrHmdStruct@@AAVFrameTimeManager@34@ABVHMDRenderState@34@@Z) [C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\obj\x86\Debug\OVR.vcxproj] C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\CAPI_DistortionRenderer.obj OpenTK.Rift Error 3 unresolved external symbol "public: static class OVR::CAPI::DistortionRenderer * cdecl OVR::CAPI::D3D10::DistortionRenderer::Create(struct ovrHmdStruct ,class OVR::CAPI::FrameTimeManager &,class OVR::CAPI::HMDRenderState const &)" (?Create@DistortionRenderer@D3D10@CAPI@OVR@@SAPAV134@PAUovrHmdStruct@@AAVFrameTimeManager@34@ABVHMDRenderState@34@@Z) [C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\obj\x86\Debug\OVR.vcxproj] C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\CAPI_DistortionRenderer.obj OpenTK.Rift Error 4 3 unresolved externals [C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\obj\x86\Debug\OVR.vcxproj] C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\obj\x86\Debug\Debug\OVR.dll OpenTK.Rift Error 5 unresolved external symbol "public: static class OVR::CAPI::DistortionRenderer * __cdecl OVR::CAPI::D3D9::DistortionRenderer::Create(struct ovrHmdStruct ,class OVR::CAPI::FrameTimeManager &,class OVR::CAPI::HMDRenderState const &)" (?Create@DistortionRenderer@D3D9@CAPI@OVR@@SAPAV134@PAUovrHmdStruct@@AAVFrameTimeManager@34@ABVHMDRenderState@34@@Z) [C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\obj\x86\Debug\OVR.vcxproj] C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\CAPI_DistortionRenderer.obj OpenTK.Rift Error 6 unresolved external symbol "public: static class OVR::CAPI::DistortionRenderer * __cdecl OVR::CAPI::D3D11::DistortionRenderer::Create(struct ovrHmdStruct ,class OVR::CAPI::FrameTimeManager &,class OVR::CAPI::HMDRenderState const &)" (?Create@DistortionRenderer@D3D11@CAPI@OVR@@SAPAV134@PAUovrHmdStruct@@AAVFrameTimeManager@34@ABVHMDRenderState@34@@Z) [C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\obj\x86\Debug\OVR.vcxproj] C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\CAPI_DistortionRenderer.obj OpenTK.Rift Error 7 unresolved external symbol "public: static class OVR::CAPI::DistortionRenderer * __cdecl OVR::CAPI::D3D10::DistortionRenderer::Create(struct ovrHmdStruct ,class OVR::CAPI::FrameTimeManager &,class OVR::CAPI::HMDRenderState const &)" (?Create@DistortionRenderer@D3D10@CAPI@OVR@@SAPAV134@PAUovrHmdStruct@@AAVFrameTimeManager@34@ABVHMDRenderState@34@@Z) [C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\obj\x86\Debug\OVR.vcxproj] C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\CAPI_DistortionRenderer.obj OpenTK.Rift Error 8 3 unresolved externals [C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\obj\x86\Debug\OVR.vcxproj] C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\obj\x86\Debug\Debug\OVR.dll OpenTK.Rift Error 9 The command "cd obj/x86/Debug && ((cmake -G"Visual Studio 11" -DCMAKE_CXX_FLAGS="/MP" -DPROJECT_NAME=OVR -DCMAKE_BUILD_TYPE=Debug -DINSTALL_DIR:PATH=../../../../bin/Debug/lib/x86/ ../../../Wrapper) || (/usr/local/bin/cmake -G"Visual Studio 11" -DCMAKE_CXX_FLAGS="/MP" -DPROJECT_NAME=OVR -DCMAKE_BUILD_TYPE=Debug -DINSTALL_DIR:PATH=../../../../bin/Debug/lib/x86/ ../../../Wrapper)) && ((cmake --build . --config Debug --target install) || (/usr/local/bin/cmake --build . --config Debug --target install)) && cd ../../../" exited with code 3. C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\OpenTK.Rift.csproj 50 5 OpenTK.Rift Error 10 Metadata file 'C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\bin\Debug\OpenTK.Rift.dll' could not be found C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\Test\Console\CSC Test.Console Error 11 Source file 'OculusCamera.cs' could not be found C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\Test\GL1\CSC Test.GL1

thefiddler commented 10 years ago

Thanks for testing.

There appear to be two separate issues:

  1. The D3D renderer files are not included when building, hence the build errors. This can be fixed by adding the D3D files in CMakeLists.txt
  2. OculusCamera.cs has been removed but the change was not committed in the .csproj file. You can simply delete OculusCamera.cs from the project and it should compile then.
murrdpirate commented 10 years ago

Ok, I made those two changes and then had some errors involving D3D1X (see end of this comment), so I tried just removing the four D3D1X references that I had added into CMakeLists.txt (kept all the D3D9, D3D10, D3D11 references). That does allow me to build successfully, but I get the following error in the console when I try to run Test.Console:

System.DllNotFoundException: Unable to load DLL 'OVR': The specified module could not be found. (Exception from HRESULT: 0x8007007E) at OpenTK.VR.Initialize() at OpenTK.Rift.TestConsole.MainClass.Main(String[] args)

Below are the errors before I removed the D3D1X refernces:

Error 1 #error : define OVR_D3D_VERSION to 10 or 11 (C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\LibOVR\Src\CAPI\D3D1X\CAPI_D3D1X_Util.cpp) [C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\obj\x86\Debug\OVR.vcxproj] c:\users\kmurray.cro-guest03\documents\visual studio 2012\projects\rift-sdk0.3.x\opentk.rift\libovr\src\capi\d3d1x\CAPI_D3D1X_Util.h 33 OpenTK.Rift Error 2 #error : define OVR_D3D_VERSION to 10 or 11 (C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\LibOVR\Src\CAPI\D3D1X\CAPI_D3D1X_DistortionRenderer.cpp) [C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\obj\x86\Debug\OVR.vcxproj] c:\users\kmurray.cro-guest03\documents\visual studio 2012\projects\rift-sdk0.3.x\opentk.rift\libovr\src\capi\d3d1x\CAPI_D3D1X_Util.h 33 OpenTK.Rift Error 3 #error : define OVR_D3D_VERSION to 10 or 11 (C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\LibOVR\Src\CAPI\D3D1X\CAPI_D3D1X_Util.cpp) [C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\obj\x86\Debug\OVR.vcxproj] c:\users\kmurray.cro-guest03\documents\visual studio 2012\projects\rift-sdk0.3.x\opentk.rift\libovr\src\capi\d3d1x\CAPI_D3D1X_Util.h 33 OpenTK.Rift Error 4 #error : define OVR_D3D_VERSION to 10 or 11 (C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\LibOVR\Src\CAPI\D3D1X\CAPI_D3D1X_DistortionRenderer.cpp) [C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\obj\x86\Debug\OVR.vcxproj] c:\users\kmurray.cro-guest03\documents\visual studio 2012\projects\rift-sdk0.3.x\opentk.rift\libovr\src\capi\d3d1x\CAPI_D3D1X_Util.h 33 OpenTK.Rift Error 5 The command "cd obj/x86/Debug && ((cmake -G"Visual Studio 11" -DCMAKE_CXX_FLAGS="/MP" -DPROJECT_NAME=OVR -DCMAKE_BUILD_TYPE=Debug -DINSTALL_DIR:PATH=../../../../bin/Debug/lib/x86/ ../../../Wrapper) || (/usr/local/bin/cmake -G"Visual Studio 11" -DCMAKE_CXX_FLAGS="/MP" -DPROJECT_NAME=OVR -DCMAKE_BUILD_TYPE=Debug -DINSTALL_DIR:PATH=../../../../bin/Debug/lib/x86/ ../../../Wrapper)) && ((cmake --build . --config Debug --target install) || (/usr/local/bin/cmake --build . --config Debug --target install)) && cd ../../../" exited with code 3. C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\OpenTK.Rift\OpenTK.Rift.csproj 50 5 OpenTK.Rift Error 6 Metadata file 'C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\bin\Debug\OpenTK.Rift.dll' could not be found C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\Test\Console\CSC Test.Console Error 7 Metadata file 'C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\bin\Debug\OpenTK.Rift.dll' could not be found C:\Users\kmurray.CRO-GUEST03\Documents\Visual Studio 2012\Projects\rift-sdk0.3.x\Test\GL1\CSC Test.GL1

murrdpirate commented 10 years ago

Did just a little bit of digging...

OVR.dll isn't found when I run Test.Console because Configuration.RunningOnWindows evaluates to false for some reason in VR.cs. Therefore, neither the 32bit nor 64bit OVR.dll's is loaded. I guess this isn't too tough to fix but I'm not sure what to change.

Test.GL1 does correctly identify that I'm on Windows and it loads the OVR.dll. However, at line 155 in Program.cs (just after libOVR is initialized), I get the following error:

EntryPointNotFoundException was unhandled. Unable to find an entry point named 'ovr_Initialize' in DLL 'OVR'.

Although everything builds without errors, I do get a bunch of warnings about obsolete classes in Test.Console.