Visual Studio 2013 Linker Errors
I'm using VS2013 Pro with the DK2 SDK, and I'm getting the following linker errors:
and
Oculus Rift DK2 Template is the project name, and the code is below:
and
Thanks for the help!
Error 1 error LNK2001: unresolved external symbol "public: static struct ovrHmdDesc_ const * const Globals::hmd" (?hmd@Globals@@2PBUovrHmdDesc_@@B) C:\Users\jgros_000\Documents\Visual Studio 2015\Projects\Oculus Rift DK2 Template\Oculus Rift DK2 Template\Main.obj Oculus Rift DK2 Template
and
Error 2 error LNK2001: unresolved external symbol "public: static struct ovrSizei_ Globals::resolution" (?resolution@Globals@@2UovrSizei_@@A) C:\Users\jgros_000\Documents\Visual Studio 2015\Projects\Oculus Rift DK2 Template\Oculus Rift DK2 Template\Main.obj Oculus Rift DK2 Template
Oculus Rift DK2 Template is the project name, and the code is below:
#pragma once
#pragma comment(lib, "Ws2_32.lib")
#include "OVR_CAPI.h"
#include "Kernel/OVR_Math.h"
#define of(x, y) y->x
struct Globals
{
public:
static ovrHmd hmd;
static ovrSizei resolution;
};
struct CurrentState
{
public:
float yaw;
float eyePitch;
float eyeRoll;
};
void initializeRift()
{
if (Globals::hmd)
{
throw "HMD already initialized!";
}
ovr_Initialize();
Globals::hmd = ovrHmd_Create(0);
if (!Globals::hmd)
{
Globals::resolution = of(Resolution, Globals::hmd);
// TODO: get more HMD specs
}
ovrHmd_ConfigureTracking(Globals::hmd, ovrTrackingCap_Orientation | ovrTrackingCap_MagYawCorrection | ovrTrackingCap_Position, 0);
}
CurrentState getState()
{
if (!Globals::hmd)
{
throw "HMD not initialized!";
}
CurrentState result;
ovrTrackingState ts = ovrHmd_GetTrackingState(Globals::hmd, ovr_GetTimeInSeconds());
if (ts.StatusFlags & (ovrStatus_OrientationTracked | ovrStatus_PositionTracked))
{
OVR::Posef pose = ts.HeadPose.ThePose;
float yaw, eyePitch, eyeRoll;
pose.Rotation.GetEulerAngles<OVR::Axis::Axis_Y, OVR::Axis::Axis_X, OVR::Axis::Axis_Z>(&yaw, &eyePitch, &eyeRoll);
result.yaw = yaw;
result.eyePitch = eyePitch;
result.eyeRoll = eyeRoll;
}
return result;
}
void destroyRift()
{
if (!Globals::hmd)
{
throw "HMD not initialized!";
}
ovrHmd_Destroy(Globals::hmd);
ovr_Shutdown();
}
and
#include "Rift.h"
#include <iostream>
int main()
{
initializeRift();
// TODO: Insert application logic
std::cout << (!Globals::hmd) << std::endl;
destroyRift();
return 0;
}
Thanks for the help!
