[英]Compiling OpenGL and GLUT OSX
I am having difficulty compiling a C program using the OpenGL and GLUT frameworks on Mac OSX. 我在使用Mac OSX上的OpenGL和GLUT框架编译C程序时遇到了困难。 I am just getting started and I attempted to run code from this tutorial, on how to install OpenGL.
我刚刚开始,我试图运行本教程中的代码,关于如何安装OpenGL。 http://www.prinmath.com/csci5229/misc/install.html .
http://www.prinmath.com/csci5229/misc/install.html 。
Here is the code: 这是代码:
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
int main(){
return 0;
}
I am trying to compile it with: 我试图编译它:
gcc -o foo foo.c -framework GLUT -framework OpenGL
I am receiving this error: 我收到此错误:
foo.c:2:23: error: GLUT/glut.h: No such file or directory
After doing some further research here, http://web.eecs.umich.edu/~sugih/courses/eecs487/glut-howto/ , I looked in /System/Library/Frameworks/ and both OpenGL.framework, and GLUT.framework where present. 在http://web.eecs.umich.edu/~sugih/courses/eecs487/glut-howto/进行了一些进一步的研究后,我查看了/ System / Library / Frameworks /以及OpenGL.framework和GLUT。存在的框架。
Any help is greatly appreciated! 任何帮助是极大的赞赏! Thank you!
谢谢!
您需要安装OpenGL Utility Toolkit glutg3-dev
lib。如果已经存在,则使用-lglut -lGLU -lGL
选项进行编译。
Without installing glutg3-dev you can use OS X GLUT and OpenGL frameworks as follows 如果不安装glutg3-dev,您可以使用OS X GLUT和OpenGL框架,如下所示
gcc -o foo foo.c -L/System/Library/Frameworks -framework GLUT -framework OpenGL
notice that it is important to tell the compiler the path to the frameworks 请注意,告诉编译器框架的路径很重要
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.