Forum Discussion

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

osx - getting project to build - help!

Hi All,

I'm having trouble building my very small application. I have a single c file (helloworld.c) as follows:

#include "OculusSDK 3/LibOVR/Include/OVR.h"

int main(int argc, char** argv) {

ovr_Initialize();
return 0;

}

And I'm using g++ as follows:

> g++ helloworld.c OculusSDK\ 3/Samples/CommonSrc/Platform/*.cpp OculusSDK\ 3/Samples/CommonSrc/Render/*.cpp OculusSDK\ 3/Samples/CommonSrc/Util/*.cpp -L OculusSDK\ 3/LibOVR/Lib/Mac/Release/ -lovr -o VROUTPUT

So, I'm including my c file, all the CommonSrc code included in the Oculus SDK, LibOVR, but i get the following error:

OculusSDK 3/Samples/CommonSrc/Util/RenderProfiler.h:27:10: fatal error: 'OVR_Kernel.h' file not found
#include "OVR_Kernel.h"
^
1 error generated.

Does anyone have a very simple application they have built on mac with all the correct libraries etc and a compile command that seems to work? Am I using the wrong compiler? Is there a "hello world" tutorial for actually building and compiling an application?

8 Replies

  • You need to set up your includes paths. An application doesn't normally hardcode a full path like "OculusSDK 3/LibOVR/Include/OVR.h". Instead is should have a list of include paths to search of which "OculusSDK 3/LibOVR/Include" might be one. Then in your code you'd simply declare


    #include <OVR.h>


    In theory, if the include paths are correct, everything will be properly loaded.
  • Hi Jherico,

    Thanks for the reply. Could you tell me - is it only LibOVR that I really need to include? Ie for a very minimal application, are all the required files in LibOVR?

    Thanks again!
  • Jherico I thought the following would work, but apparently not:

    g++ -I/Applications/OculusSDK\ 3/LibOVR/Src -I/Applications/OculusSDK\ 3/LibOVR/Include -L/Applications/OculusSDK\ 3/LibOVR/Lib/Mac/Debug/ test.c -lovr -o vroutput

    I get a bunch of errors such as:

    Undefined symbols for architecture x86_64:
    "_CFDataGetBytePtr", referenced from:
    OVR::discoverExtendedRifts(OVR::OSX::DisplayDesc*, int, bool) in libovr.a(OVR_OSX_Display.o)
  • There are a number of OSX frameworks that you need to link against. The details are in the example XCode projects in the SDK download. Alternatively, my CMake files also setup project files (makefiles, xcode projects, whatever) which properly target the required libraries.

    I can't really walk you through the specifics of how you'd set up GCC to link to them. Avoiding the minutiae of platform specific linking is one of the reasons I use CMake in the first place, and OSX is the platform with which I have the least experience.
  • No problem - assuming i've cloned your repo with your examples, exactly what command do I issue to create one of the apps, and where is the binary once the command has been run?
  • Thanks again Jherico.

    I'm having trouble with the examples on mac. They seem to crash (other than the first one), the error is as follows:

    FATAL ..../OculusRiftInAction/examples/cpp/common/GlfwApp.cpp (93): Failed to initialize GLFW