Developing OpenGL applications in C/C++ requires a slightly more care when targetting multiple platforms. In order to tackle both Windows and Mac OSX the preprocessor pattern below is used to ensure the correct GL/glut.h/windows.h is included correctly.

Preprocessor #ifdef statements

Here’s an example of the includes, which can be seen in Poseidon; a 3D OpenGL video game I wrote and shared on GitHub in the hopes that somebody may find it useful.

    /* If I'm developing on my Mac OSX box */
    #ifdef __APPLE__
    #include // your OSX includes
    /* Or my Windows 7 box */
    #ifdef _WIN32
    #include // your Win32/64 includes