New to the forums? Click here to read the How To guide. -- Developers click here.

0.4.0 SDK linker errors

RajveerRajveer Posts: 73
Hiro Protagonist
edited March 2015 in Support
I'm trying to integrate LibOVR into my game engine and am running in to a bunch of linker errors (I'm using VS2013 for a 32-bit application). Performing the normal steps and also using the OculusRoomTiny sample as a guide, I:

- add the paths for both LibOVR\Include and LibOVR\Src to "C++->Additional Include Directories"
- add the path for LibOVR\Lib\Win32\VS2013 to "Linker->Additional Library Directories"
- add "libovrd.lib"/"libovr.lib" for Debug/Release builds to "Linker->Input->Additional Dependencies".

I then go by the documentation and import "OVR_CAPI.h" and then try calling "ovr_Initialize();". The linker errors I get are:
1>libovrd.lib(OVR_Timer.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "public: unsigned __int64 __thiscall OVR::PerformanceTimer::GetTimeNanos(void)" ([email protected]@[email protected]@QAE_KXZ)
1>libovrd.lib(OVR_Timer.obj) : error LNK2019: unresolved external symbol __imp__timeBeg[email protected] referenced in function "public: void __thiscall OVR::PerformanceTimer::Initialize(void)" ([email protected]@[email protected]@QAEXXZ)
1>libovrd.lib(OVR_Timer.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "public: void __thiscall OVR::PerformanceTimer::Shutdown(void)" ([email protected]@[email protected]@QAEXXZ)
1>libovrd.lib(OVR_BitStream.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "public: static bool __cdecl OVR::Net::BitStream::IsNetworkOrderInternal(void)" ([email protected]@[email protected]@@SA_NXZ)
1>libovrd.lib(OVR_Win32_Socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "public: void __thiscall OVR::Net::TCPSocketPollState::HandleEvent(class OVR::Net::TCPSocket *,class OVR::Net::SocketEvent_TCP *)" ([email protected]@[email protected]@@[email protected]@[email protected]@@Z)
1>libovrd.lib(OVR_Win32_Socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "public: void __thiscall OVR::Net::TCPSocketPollState::HandleEvent(class OVR::Net::TCPSocket *,class OVR::Net::SocketEvent_TCP *)" ([email protected]@[email protected]@@[email protected]@[email protected]@@Z)
1>libovrd.lib(OVR_Win32_Socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "unsigned int __cdecl OVR::Net::BindShared(int,int,struct OVR::Net::BerkleyBindParameters *)" ([email protected]@[email protected]@[email protected]@@Z)
1>libovrd.lib(OVR_Win32_Socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "public: virtual void __thiscall OVR::Net::BerkleySocket::Close(void)" ([email protected]@[email protected]@@UAEXXZ)
1>libovrd.lib(OVR_Win32_Socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "public: virtual int __thiscall OVR::Net::TCPSocket::Connect(class OVR::Net::SockAddr *)" ([email protected]@[email protected]@@[email protected]@@Z)
1>libovrd.lib(OVR_Win32_Socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "void __cdecl OVR::Net::_Ioctlsocket(unsigned int,unsigned long)" ([email protected]@[email protected]@[email protected])
1>libovrd.lib(OVR_Win32_Socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "public: virtual int __thiscall OVR::Net::BerkleySocket::GetSockname(class OVR::Net::SockAddr *)" ([email protected]@[email protected]@@[email protected]@@Z)
1>libovrd.lib(OVR_Win32_Socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "public: unsigned short __thiscall OVR::Net::SockAddr::GetPort(void)" ([email protected]@[email protected]@@QAEGXZ)
1>libovrd.lib(OVR_Win32_Socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "public: virtual int __thiscall OVR::Net::TCPSocket::Listen(void)" ([email protected]@[email protected]@@UAEHXZ)
1>libovrd.lib(OVR_Win32_Socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "public: class OVR::String __thiscall OVR::Net::SockAddr::ToString(bool,char)const " ([email protected]@[email protected]@@[email protected]@[email protected])
1>libovrd.lib(OVR_Win32_Socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "public: void __thiscall OVR::Net::TCPSocketPollState::HandleEvent(class OVR::Net::TCPSocket *,class OVR::Net::SocketEvent_TCP *)" ([email protected]@[email protected]@@[email protected]@[email protected]@@Z)
1>libovrd.lib(OVR_Win32_Socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "public: virtual void __thiscall OVR::Net::UDPSocket::Poll(class OVR::Net::SocketEvent_UDP *)" ([email protected]@[email protected]@@UA[email protected]@@Z)
1>libovrd.lib(OVR_Win32_Socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "public: bool __thiscall OVR::Net::TCPSocketPollState::Poll(long,long)" ([email protected]@[email protected]@@[email protected])
1>libovrd.lib(OVR_Win32_Socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "public: virtual int __thiscall OVR::Net::TCPSocket::Send(void const *,int)" ([email protected]@[email protected]@@[email protected])
1>libovrd.lib(OVR_Win32_Socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "public: virtual int __thiscall OVR::Net::UDPSocket::Send(void const *,int,class OVR::Net::SockAddr *)" ([email protected]@[email protected]@@[email protected]@@Z)
1>libovrd.lib(OVR_Win32_Socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "void __cdecl OVR::Net::SetSocketOptions(unsigned int)" ([email protected]@[email protected]@[email protected])
1>libovrd.lib(OVR_Win32_Socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "unsigned int __cdecl OVR::Net::BindShared(int,int,struct OVR::Net::BerkleyBindParameters *)" ([email protected]@[email protected]@[email protected]@@Z)
1>libovrd.lib(OVR_Win32_Socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "public: static void __cdecl OVR::Net::WSAStartupSingleton::AddRef(void)" ([email protected]@[email protected]@@SAXXZ)
1>libovrd.lib(OVR_Win32_Socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "public: static void __cdecl OVR::Net::WSAStartupSingleton::Deref(void)" ([email protected]@[email protected]@@SAXXZ)
1>libovrd.lib(OVR_Win32_Socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "public: virtual int __thiscall OVR::Net::TCPSocket::Connect(class OVR::Net::SockAddr *)" ([email protected]@[email protected]@@[email protected]@@Z)
1>libovrd.lib(OVR_Win32_Socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "public: void __thiscall OVR::Net::SockAddr::Set(char const *,unsigned short,int)" ([email protected]@[email protected]@@[email protected])
1>libovrd.lib(OVR_Win32_Socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "public: void __thiscall OVR::Net::SockAddr::Set(char const *,unsigned short,int)" ([email protected]@[email protected]@@[email protected])
1>libovrd.lib(OVR_Win32_Socket.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "public: class OVR::String __thiscall OVR::Net::SockAddr::ToString(bool,char)const " ([email protected]@[email protected]@@[email protected]@[email protected])

Are there any steps that I am missing?

Comments

  • RajveerRajveer Posts: 73
    Hiro Protagonist
    Found this thread which solved it:

    viewtopic.php?f=34&t=473

    As I couldn't (nor should have to be) bothered to find out which libraries libovr needs to link against, I just copied all of the dependencies that OculusRoomTiny uses. If libovr requires us to link against additional libraries, this should be mentioned in the documentation as I don't think it should be on the developer to trial-and-error each library in OculusRoomTiny to see if their application compiles.
  • cyberealitycybereality Posts: 26,156 Oculus Staff
    Thanks for following up on this.

    I've already brought this up with the team, and we should be updating the documentation soon to reflect this.

    Sorry for the confusion.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i
    Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
  • RajveerRajveer Posts: 73
    Hiro Protagonist
    No need to apologise, I understand that this is all still WIP (hence not being called a 1.0 SDK ;)).
  • YUP, just want to second this.

    Got my OVR today, went ahead to get a test project up and running and ran into this linker issue -- wasn't sure if I built the right lib, was missing includes or had my paths correct, so spent some time thinking I was an idiot. Led me to conclude I was missing other libs (and confirmed with some searching).

    Not a huge deal, just an annoyance when you're following along the otherwise thorough documentation on integrating the SDK into your app. Would have figured it out on my own, but it was a bit of a hiccup in an otherwise awesome job with the documentation. Just needs something like the following to avoid some initial frustration:

    "Since the SDK depends on other standard libraries (e.g. winmm.lib, kernel32.lib, user32.lib, etc), you'll need to make sure your project links against those as well. The easiest way to make sure you're not missing anything is to simply add the same libs that the TinyRoom project depends on to your project."
  • I'm having issues, it should be right now but it isn't working. Spent 2 weeks on this crazy linker issue! Here are my errors:
    1>Oculus.obj : error LNK2019: unresolved external symbol _ovr_Initialize referenced in function "void __cdecl Initialization(struct ovrHmdDesc_ const *)" ([email protected]@[email protected]@@Z)
    1>Oculus.obj : error LNK2019: unresolved external symbol _ovr_Shutdown referenced in function "void __cdecl ExitRift(struct ovrHmdDesc_ const *)" ([email protected]@[email protected]@@Z)
    1>Oculus.obj : error LNK2019: unresolved external symbol _ovrHmd_Destroy referenced in function "void __cdecl ExitRift(struct ovrHmdDesc_ const *)" ([email protected]@[email protected]@@Z)
    1>Oculus.obj : error LNK2019: unresolved external symbol _ovrHmd_ConfigureTracking referenced in function "void __cdecl Tracking(struct ovrHmdDesc_ const *)" ([email protected]@[email protected]@@Z)
    1>Oculus.obj : error LNK2019: unresolved external symbol _ovrHmd_GetTrackingState referenced in function "void __cdecl Tracking(struct ovrHmdDesc_ const *)" ([email protected]@[email protected]@@Z)
    

    My Code is pretty simple... updated from the developer guide, which is obsolete (just getting functions ready for my main app):

    Oculus.h
    //#include <cmath>
    #include "OVR.h"
    #include "OVR_Kernel.h"
    // Include the OculusVR SDK
    #include "OVR_CAPI.h"
    
    #include "DirectXTemplatePCH.h"
    
    //#include "Win32_DX11AppUtil.h"         // Include Non-SDK supporting utilities
    
    using namespace OVR;
    using namespace std;
    
    // include the Direct3D Library file
    //#pragma comment (lib, "d3d11.lib")
    // define the screen resolution
    #define SCREEN_WIDTH  800
    #define SCREEN_HEIGHT 600
    
    // function prototypes
    void Initialization(ovrHmd hmd);
    void Tracking(ovrHmd hmd);
    void ExitRift(ovrHmd hmd);
    


    Oculus.cpp
    #include "Oculus.h"
    
    HWND ghMainWnd = 0;
    
    // global declarations
    IDXGISwapChain *swapchain;             // the pointer to the swap chain interface
    ID3D11Device *dev;                     // the pointer to our Direct3D device interface
    ID3D11DeviceContext *devcon;           // the pointer to our Direct3D device context
    ID3D11RenderTargetView *backbuffer;    // global declaration
    
    
    void Initialization(ovrHmd hmd)
    {
    	ovr_Initialize();
    
    	if (hmd)
    	{
    		// Get more details about the HMD.
    		ovrSizei resolution = hmd->Resolution;
    	}
    }
    
    void Tracking(ovrHmd hmd)
    {
    	// Do something with the HMD.
    	// Start the sensor which provides the Rift’s pose and motion.
    	ovrHmd_ConfigureTracking(hmd, ovrTrackingCap_Orientation |
    		ovrTrackingCap_MagYawCorrection |
    		ovrTrackingCap_Position, 0);
    	// Query the HMD for the current tracking state.
    	ovrTrackingState ts = ovrHmd_GetTrackingState(hmd, ovr_GetTimeInSeconds());
    	if (ts.StatusFlags & (ovrStatus_OrientationTracked | ovrStatus_PositionTracked))
    	{
    		ovrPosef pose = ts.HeadPose.ThePose;
    		float yaw;
    		float eyePitch;
    		float eyeRoll;
    		eyePitch = pose.Orientation.x;
    		eyeRoll = pose.Orientation.z;
    		yaw = pose.Orientation.y;
    		pose.Orientation.w;
    	}
    }
    
    void ExitRift(ovrHmd hmd){
    	ovrHmd_Destroy(hmd);
    	ovr_Shutdown();
    }
    

    Windows 64-BIT, Visual Studio 2013 Properties:
    Linker-->General-->Additional Library Directories:
    LibOVR\Lib\x64\VS2013;%(AdditionalLibraryDirectories)

    Linker-->Input-->additional dependancies:
    ws2_32.lib
    Dbghelp.lib
    libovr64.lib
    dxguid.lib
    dxgi.lib
    d3d10.lib
    d3d11.lib
    d3dcompiler.lib
    winmm.lib
    kernel32.lib
    user32.lib
    gdi32.lib
    winspool.lib
    comdlg32.lib
    advapi32.lib
    shell32.lib
    ole32.lib
    oleaut32.lib
    uuid.lib
    odbc32.lib
    odbccp32.lib

    C++-->General-->Additional Include Directories:
    LibOVR\Include
    LibOVR\Src

    I have no idea what I am doing wrong
Sign In or Register to comment.