cancel
Showing results for 
Search instead for 
Did you mean: 

ovrhmd_EnableHSWDisplaySDKRender Linking error

EpicZa
Honored Guest
So im trying to compile this

http://nuclear.mutantstargoat.com/hg/oculus2/file/5558b43eb653/src/main.c
(Want to use opengl as I want to add in LeapMotion with minimal effort, but thats for later..)

And I spent ages trying to figure out what .libs I was missing, and Ive now added all those in the tiny room demo.

But I'm still getting one error:

1>Source.obj : error LNK2019: unresolved external symbol "void __cdecl ovrhmd_EnableHSWDisplaySDKRender(struct ovrHmdDesc_ const *,char)" (?ovrhmd_EnableHSWDisplaySDKRender@@YAXPBUovrHmdDesc_@@D@Z) referenced in function "int __cdecl init(void)" (?init@@YAHXZ)

Google has proved fruitless so Im stuck.
Any Advice?
7 REPLIES 7

kojack
MVP
MVP
Which sdk version are you running?
ovrhmd_EnableHSWDisplaySDKRender was introduced in sdk 0.4.0.

Make sure there's no old libovr.lib (or libovrd.lib for debug builds) files in your linker's path.

Did you build libovr.lib yourself or use the prebuilt one?

EpicZa
Honored Guest
4.4

No they the .libs are straight from the SDK folder, no old ones, I used the pre built one.

Ill try readding them and see

EDIT: Ok the error fixed when i readded everything for some reason.
But now its throwing me errors in OVR's headers

1>c:\users\XYZ\google drive\libraries\oculus\src\ovr_capi_gl.h(37): error C2146: syntax error : missing ';' before identifier 'Window'
1>c:\users\XYZ\google drive\libraries\oculus\src\ovr_capi_gl.h(37): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\XYZ\google drive\libraries\oculus\src\ovr_capi_gl.h(39): error C2146: syntax error : missing ';' before identifier 'DC'
1>c:\users\XYZ\google drive\libraries\oculus\src\ovr_capi_gl.h(39): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

Which is this?
/// Used to configure slave GL rendering (i.e. for devices created externally).
typedef struct OVR_ALIGNAS(8) ovrGLConfigData_s
{
/// General device settings.
ovrRenderAPIConfigHeader Header;

#if defined(OVR_OS_WIN32)
/// The optional window handle. If unset, rendering will use the current window.
HWND Window;
/// The optional device context. If unset, rendering will use a new context.
HDC DC;
#elif defined (OVR_OS_LINUX)
/// Optional display. If unset, will issue glXGetCurrentDisplay when context
/// is current.
struct _XDisplay* Disp;
#endif
} ovrGLConfigData;


Im lost

kojack
MVP
MVP
That's failing on the HWND and HDC win32 types. Try including windows.h in your program before OVR_CAPI_GL.h

EpicZa
Honored Guest
That fixed the second error, now I'm back at square one haha.

I've found a simpler method here: http://pastebin.com/qqH22Yb6

I got it to build and run so I think I mess around with it to learn more. Thanks for your help.

rasta
Honored Guest
I have the same error. How can i fix it?

My problem is in the config of the project's visual studio because I have two project with the same code, i download one sample and work fine. But when I create the same sample in a new project then this dont work. It get the same error.

I've configured the lib libovrd.lib and all option for config in both project. but one of them give the same error.

Thank you!!

"EpicZa" wrote:
So im trying to compile this

http://nuclear.mutantstargoat.com/hg/oc ... src/main.c
(Want to use opengl as I want to add in LeapMotion with minimal effort, but thats for later..)

And I spent ages trying to figure out what .libs I was missing, and Ive now added all those in the tiny room demo.

But I'm still getting one error:

1>Source.obj : error LNK2019: unresolved external symbol "void __cdecl ovrhmd_EnableHSWDisplaySDKRender(struct ovrHmdDesc_ const *,char)" (?ovrhmd_EnableHSWDisplaySDKRender@@YAXPBUovrHmdDesc_@@D@Z) referenced in function "int __cdecl init(void)" (?init@@YAHXZ)

Google has proved fruitless so Im stuck.
Any Advice?

rasta
Honored Guest
I found the problem, this function "ovrhmd_EnableHSWDisplaySDKRender" is declarate as EXTERN C,

And my project was CPP. I change the extension .cpp to .c and it work now.

"rasta" wrote:
I have the same error. How can i fix it?

My problem is in the config of the project's visual studio because I have two project with the same code, i download one sample and work fine. But when I create the same sample in a new project then this dont work. It get the same error.

I've configured the lib libovrd.lib and all option for config in both project. but one of them give the same error.

Thank you!!

"EpicZa" wrote:
So im trying to compile this

http://nuclear.mutantstargoat.com/hg/oc ... src/main.c
(Want to use opengl as I want to add in LeapMotion with minimal effort, but thats for later..)

And I spent ages trying to figure out what .libs I was missing, and Ive now added all those in the tiny room demo.

But I'm still getting one error:

1>Source.obj : error LNK2019: unresolved external symbol "void __cdecl ovrhmd_EnableHSWDisplaySDKRender(struct ovrHmdDesc_ const *,char)" (?ovrhmd_EnableHSWDisplaySDKRender@@YAXPBUovrHmdDesc_@@D@Z) referenced in function "int __cdecl init(void)" (?init@@YAHXZ)

Google has proved fruitless so Im stuck.
Any Advice?

kojack
MVP
MVP
"rasta" wrote:
I found the problem, this function "ovrhmd_EnableHSWDisplaySDKRender" is declarate as EXTERN C,

And my project was CPP. I change the extension .cpp to .c and it work now.

Did you include CAPI_HSWDisplay.h?
extern "C" changes the name mangling used by the compiler. In C, functions in libraries have simple names (the function name), but in C++ the name is "mangled" to add more meaning (special letters and symbols are added to describe parameter and return types).
The ovrhmd_EnableHSWDisplaySDKRender call is defined as extern "C", so it uses the C style naming in the library. CAPI_HSWDisplay.h declares the ovrhmd_EnableHSWDisplaySDKRender prototype as extern "C" as well. As long as you include that file, your compiler will know to use C naming instead of C++ mangling when looking for that one function.
There's no need to change your file extension.