Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
ChrisTheEnginee's avatar
ChrisTheEnginee
Honored Guest
11 years ago

Issues with VS2013 configuration, undeclared identifiers

Hello, I am trying to do the simple Minimal Oculus tutorial to configure the SDK 0.4.0 for Visual Studio 2013 (https://developer.oculusvr.com/wiki/Minimal_Oculus_Application_0.3.x). I realize this tutorial is for the 0.3.x version but believe it should be the same process and if not the official tutorial would have been updated. I have followed the directions as stated in the tutorial and currently have the following code:


#include "OVR_CAPI.h"d
#include "Kernel\OVR_Math.h"

using namespace OVR;

ovrHmd hmd; //global variables, should be members of class in future
ovrHmdDesc hmdDesc;
ovrFrameTiming frameTiming;

void Init(){//initialize the SDK
ovr_Initialize();

hmd = ovrHmd_Create(0);

if (!hmd) return;

ovrHmd_GetDesc(hmd, &hmdDesc);

ovrHmd_StartSensor(hmd, ovrSensorCap_Orientation | ovrSensorCap_YawCorrection |
ovrSensorCap_Position, ovrSensorCap_Orientation);
}

void Clear(){//a "destructor"
ovrHmd_Destroy(hmd);

ovr_Shutdown();
}

int main(){
Init();

Clear();

return 0;
}


Just to make sure everything is working correctly. However I am getting a couple of errors stating that a few things are undefied however not exactly sure why since the configuration seems pretty much straight forward. Below is my error log:


Error 1 error C3861: 'ovrHmd_GetDesc': identifier not found d:\senior design\oculus test\oculus test\main.cpp 21 1 Oculus Test
Error 2 error C2065: 'ovrSensorCap_Orientation' : undeclared identifier d:\senior design\oculus test\oculus test\main.cpp 23 1 Oculus Test
Error 3 error C2065: 'ovrSensorCap_YawCorrection' : undeclared identifier d:\senior design\oculus test\oculus test\main.cpp 23 1 Oculus Test
Error 4 error C2065: 'ovrSensorCap_Position' : undeclared identifier d:\senior design\oculus test\oculus test\main.cpp 24 1 Oculus Test
Error 5 error C2065: 'ovrSensorCap_Orientation' : undeclared identifier d:\senior design\oculus test\oculus test\main.cpp 24 1 Oculus Test
Error 6 error C3861: 'ovrHmd_StartSensor': identifier not found d:\senior design\oculus test\oculus test\main.cpp 23 1 Oculus Test
7 IntelliSense: identifier "ovrHmd_GetDesc" is undefined d:\Senior Design\Oculus Test\Oculus Test\Main.cpp 17 2 Oculus Test
8 IntelliSense: identifier "ovrHmd_StartSensor" is undefined d:\Senior Design\Oculus Test\Oculus Test\Main.cpp 19 2 Oculus Test
9 IntelliSense: identifier "ovrSensorCap_Orientation" is undefined d:\Senior Design\Oculus Test\Oculus Test\Main.cpp 19 26 Oculus Test
10 IntelliSense: identifier "ovrSensorCap_YawCorrection" is undefined d:\Senior Design\Oculus Test\Oculus Test\Main.cpp 19 53 Oculus Test
11 IntelliSense: identifier "ovrSensorCap_Position" is undefined d:\Senior Design\Oculus Test\Oculus Test\Main.cpp 20 3 Oculus Test



I have done similar configurations when including SDKs or libraries without fail. Any insight would be great, especially from people who may have dealt with this problem and solved it.

Thanks!

10 Replies

  • dghost's avatar
    dghost
    Honored Guest
    From the 0.4.0 SDK release notes:

    * Various "Sensor" functions and structures were renamed to "Tracking"
    equivalents. For example, ovrSensorState is now ovrTrackingState,
    returned by ovrHmd_GetTrackingState.

    * ovrHmd is now a pointer to ovrHmdDesc, with relevant members being
    accessible directly. ovrHmd_GetHmdDesc function was removed.

    * ovrHmd_StartSensor and ovrHmd_StopSensor functions were removed; please
    use ovrHmd_ConfigureTracking instead.


    If you change the code as follows it should work:

    #include "OVR_CAPI.h"
    #include "Kernel\OVR_Math.h"

    using namespace OVR;

    ovrHmd hmd; //global variables, should be members of class in future
    ovrFrameTiming frameTiming;

    void Init()
    {
    //initialize the SDK
    ovr_Initialize();

    hmd = ovrHmd_Create(0);

    if (!hmd)
    return;

    ovrHmd_ConfigureTracking (hmd, ovrTrackingCap_Orientation |
    ovrTrackingCap_Position, ovrTrackingCap_Orientation);
    }

    void Clear(){//a "destructor"
    ovrHmd_Destroy(hmd);

    ovr_Shutdown();
    }

    int main(){
    Init();

    Clear();

    return 0;
    }
  • Thanks that got rid of the issue of undeclared identifiers but now it is giving me linking errors. Below are the errors I am getting.


    Error 1 error LNK2019: unresolved external symbol __imp__htonl@4 referenced in function "public: static bool __cdecl OVR::Net::BitStream::IsNetworkOrderInternal(void)" (?IsNetworkOrderInternal@BitStream@Net@OVR@@SA_NXZ) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_BitStream.obj) Oculus Test 2
    Error 2 error LNK2019: unresolved external symbol ___WSAFDIsSet@8 referenced in function "public: void __thiscall OVR::Net::TCPSocketPollState::HandleEvent(class OVR::Net::TCPSocket *,class OVR::Net::SocketEvent_TCP *)" (?HandleEvent@TCPSocketPollState@Net@OVR@@QAEXPAVTCPSocket@23@PAVSocketEvent_TCP@23@@Z) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_Win32_Socket.obj) Oculus Test 2
    Error 3 error LNK2019: unresolved external symbol __imp__accept@12 referenced in function "public: void __thiscall OVR::Net::TCPSocketPollState::HandleEvent(class OVR::Net::TCPSocket *,class OVR::Net::SocketEvent_TCP *)" (?HandleEvent@TCPSocketPollState@Net@OVR@@QAEXPAVTCPSocket@23@PAVSocketEvent_TCP@23@@Z) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_Win32_Socket.obj) Oculus Test 2
    Error 4 error LNK2019: unresolved external symbol __imp__bind@12 referenced in function "unsigned int __cdecl OVR::Net::BindShared(int,int,struct OVR::Net::BerkleyBindParameters *)" (?BindShared@Net@OVR@@YAIHHPAUBerkleyBindParameters@12@@Z) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_Win32_Socket.obj) Oculus Test 2
    Error 5 error LNK2019: unresolved external symbol __imp__closesocket@4 referenced in function "public: virtual void __thiscall OVR::Net::BerkleySocket::Close(void)" (?Close@BerkleySocket@Net@OVR@@UAEXXZ) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_Win32_Socket.obj) Oculus Test 2
    Error 6 error LNK2019: unresolved external symbol __imp__connect@12 referenced in function "public: virtual int __thiscall OVR::Net::TCPSocket::Connect(class OVR::Net::SockAddr *)" (?Connect@TCPSocket@Net@OVR@@UAEHPAVSockAddr@23@@Z) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_Win32_Socket.obj) Oculus Test 2
    Error 7 error LNK2019: unresolved external symbol __imp__ioctlsocket@12 referenced in function "void __cdecl OVR::Net::_Ioctlsocket(unsigned int,unsigned long)" (?_Ioctlsocket@Net@OVR@@YAXIK@Z) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_Win32_Socket.obj) Oculus Test 2
    Error 8 error LNK2019: unresolved external symbol __imp__getsockname@12 referenced in function "public: virtual int __thiscall OVR::Net::BerkleySocket::GetSockname(class OVR::Net::SockAddr *)" (?GetSockname@BerkleySocket@Net@OVR@@UAEHPAVSockAddr@23@@Z) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_Win32_Socket.obj) Oculus Test 2
    Error 9 error LNK2019: unresolved external symbol __imp__htons@4 referenced in function "public: unsigned short __thiscall OVR::Net::SockAddr::GetPort(void)" (?GetPort@SockAddr@Net@OVR@@QAEGXZ) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_Win32_Socket.obj) Oculus Test 2
    Error 10 error LNK2019: unresolved external symbol __imp__listen@8 referenced in function "public: virtual int __thiscall OVR::Net::TCPSocket::Listen(void)" (?Listen@TCPSocket@Net@OVR@@UAEHXZ) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_Win32_Socket.obj) Oculus Test 2
    Error 11 error LNK2019: unresolved external symbol __imp__ntohs@4 referenced in function "public: class OVR::String __thiscall OVR::Net::SockAddr::ToString(bool,char)const " (?ToString@SockAddr@Net@OVR@@QBE?AVString@3@_ND@Z) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_Win32_Socket.obj) Oculus Test 2
    Error 12 error LNK2019: unresolved external symbol __imp__recv@16 referenced in function "public: void __thiscall OVR::Net::TCPSocketPollState::HandleEvent(class OVR::Net::TCPSocket *,class OVR::Net::SocketEvent_TCP *)" (?HandleEvent@TCPSocketPollState@Net@OVR@@QAEXPAVTCPSocket@23@PAVSocketEvent_TCP@23@@Z) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_Win32_Socket.obj) Oculus Test 2
    Error 13 error LNK2019: unresolved external symbol __imp__recvfrom@24 referenced in function "public: virtual void __thiscall OVR::Net::UDPSocket::Poll(class OVR::Net::SocketEvent_UDP *)" (?Poll@UDPSocket@Net@OVR@@UAEXPAVSocketEvent_UDP@23@@Z) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_Win32_Socket.obj) Oculus Test 2
    Error 14 error LNK2019: unresolved external symbol __imp__select@20 referenced in function "public: bool __thiscall OVR::Net::TCPSocketPollState::Poll(long,long)" (?Poll@TCPSocketPollState@Net@OVR@@QAE_NJJ@Z) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_Win32_Socket.obj) Oculus Test 2
    Error 15 error LNK2019: unresolved external symbol __imp__send@16 referenced in function "public: virtual int __thiscall OVR::Net::TCPSocket::Send(void const *,int)" (?Send@TCPSocket@Net@OVR@@UAEHPBXH@Z) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_Win32_Socket.obj) Oculus Test 2
    Error 16 error LNK2019: unresolved external symbol __imp__sendto@24 referenced in function "public: virtual int __thiscall OVR::Net::UDPSocket::Send(void const *,int,class OVR::Net::SockAddr *)" (?Send@UDPSocket@Net@OVR@@UAEHPBXHPAVSockAddr@23@@Z) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_Win32_Socket.obj) Oculus Test 2
    Error 17 error LNK2019: unresolved external symbol __imp__setsockopt@20 referenced in function "void __cdecl OVR::Net::SetSocketOptions(unsigned int)" (?SetSocketOptions@Net@OVR@@YAXI@Z) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_Win32_Socket.obj) Oculus Test 2
    Error 18 error LNK2019: unresolved external symbol __imp__socket@12 referenced in function "unsigned int __cdecl OVR::Net::BindShared(int,int,struct OVR::Net::BerkleyBindParameters *)" (?BindShared@Net@OVR@@YAIHHPAUBerkleyBindParameters@12@@Z) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_Win32_Socket.obj) Oculus Test 2
    Error 19 error LNK2019: unresolved external symbol __imp__WSAStartup@8 referenced in function "public: static void __cdecl OVR::Net::WSAStartupSingleton::AddRef(void)" (?AddRef@WSAStartupSingleton@Net@OVR@@SAXXZ) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_Win32_Socket.obj) Oculus Test 2
    Error 20 error LNK2019: unresolved external symbol __imp__WSACleanup@0 referenced in function "public: static void __cdecl OVR::Net::WSAStartupSingleton::Deref(void)" (?Deref@WSAStartupSingleton@Net@OVR@@SAXXZ) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_Win32_Socket.obj) Oculus Test 2
    Error 21 error LNK2019: unresolved external symbol __imp__WSAGetLastError@0 referenced in function "public: virtual int __thiscall OVR::Net::TCPSocket::Connect(class OVR::Net::SockAddr *)" (?Connect@TCPSocket@Net@OVR@@UAEHPAVSockAddr@23@@Z) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_Win32_Socket.obj) Oculus Test 2
    Error 22 error LNK2019: unresolved external symbol __imp__getaddrinfo@16 referenced in function "public: void __thiscall OVR::Net::SockAddr::Set(char const *,unsigned short,int)" (?Set@SockAddr@Net@OVR@@QAEXPBDGH@Z) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_Win32_Socket.obj) Oculus Test 2
    Error 23 error LNK2019: unresolved external symbol __imp__freeaddrinfo@4 referenced in function "public: void __thiscall OVR::Net::SockAddr::Set(char const *,unsigned short,int)" (?Set@SockAddr@Net@OVR@@QAEXPBDGH@Z) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_Win32_Socket.obj) Oculus Test 2
    Error 24 error LNK2019: unresolved external symbol __imp__getnameinfo@28 referenced in function "public: class OVR::String __thiscall OVR::Net::SockAddr::ToString(bool,char)const " (?ToString@SockAddr@Net@OVR@@QBE?AVString@3@_ND@Z) D:\Senior Design\Oculus Test 2\Oculus Test 2\libovrd.lib(OVR_Win32_Socket.obj) Oculus Test 2
    Error 25 error LNK1120: 24 unresolved externals D:\Senior Design\Oculus Test 2\Debug\Oculus Test 2.exe Oculus Test 2

  • The new SDK requires the Windows socket libraries to communicate with the runtime. Add 'ws2_32.lib' to your linked libraries list.
  • I fixed this issue myself by finding this post. I would be nice if someone could add this information to the tutorial
  • Tourgen's avatar
    Tourgen
    Honored Guest
    Why does the SDK require the sockets library? It's an HMD interface SDK not a networking app.
  • "Tourgen" wrote:
    Why does the SDK require the sockets library? It's an HMD interface SDK not a networking app.

    The libovr library no longer contains all functionality. Instead, some of it's methods actually use local network packets to communicate with the oculus service (closed source binary service) to do the actual work. For example, most of the direct to rift stuff is hidden in the service.
  • Cgpnz's avatar
    Cgpnz
    Honored Guest
    "kojack" wrote:
    "Tourgen" wrote:
    Why does the SDK require the sockets library? It's an HMD interface SDK not a networking app.

    The libovr library no longer contains all functionality. Instead, some of it's methods actually use local network packets to communicate with the oculus service (closed source binary service) to do the actual work. For example, most of the direct to rift stuff is hidden in the service.



    Does this portent to why the DK2 is essentually non-functional? Is sockets communication not workable with 50ms lag period restrictions?
  • "Cgpnz" wrote:

    Does this portent to why the DK2 is essentually non-functional? Is sockets communication not workable with 50ms lag period restrictions?


    Sockets are used as a control channel, to give the runtimes commands, such as enabling tracking. Sockets are not used for accessing the sensor data. Instead the runtime maintains provides a global shared memory space from which the application can read the sensor/pose data at any time.

    If you search the SDK for 'LocklessSensorState' you can track down the code where it's actually being read from the shared memory.