I just tried to compile an open source C++ application on my Mac. I get the error GL/gl.h file not found. I know that this means that it can't find the open GL library, which it needs to compile and run. I am confused about what to do next because
So I am confused about what to do next. Do I download OpenGL and link it to my project? Do I configure xcode to use a native version of OpenGL? Do I change the headers?
Can someone provide a little more direction. This answer gave windows/linux answers -- but not OS X: How to get the GL library/headers?
Apple thought it was clever if they were incompatible to everybody else and placed the OpenGL headers in a directory called OpenGL
not just GL
. So you must use
#include <OpenGL/gl.h>
on Apple systems and
#include <GL/gl.h>
everywhere else. Compiler predefined preprocessor macros are your friend here.
#ifdef __APPLE__
# include <OpenGL/gl.h>
#else
# include <GL/gl.h>
#endif/*__APPLE__*/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With