glewInit() fails on macOS

孤街醉人 提交于 2019-11-30 21:18:58

glewInit() call (and the includes, of course) is not necessary on MacOS, so you might just exclude it this way:

#ifndef __APPLE__
glewInit();
#endif

The same with includes.

Now with the unresolved symbols. You have to include MacOSX's native GL headers:

#ifdef __APPLE__
#  include <OpenGL/gl.h>
#  include <OpenGL/glext.h>
#else /// your stuff for linux
#  include "GL/GL.h"
.... whatever
#endif

OpenGL is a core technology for OSX, not an "extension", as in Linux/X Window. So just include the OpenGL and GLUT framework to your XCode project and hopefully it should build and work.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!