安装 Mesa 来替换 GLUT 但出现编译错误
我正在尝试从红皮书中运行 hello.c在 MAC OS X Lion 上。我尝试通过“sudo port install glut”安装 GLUT,但收到消息:错误: glut 已被 mesa 取代;请安装 mesa。
所以,我安装了 mesa。但是,我仍然无法编译我的 hello.c。我使用以下命令进行编译:
gcc -lglut hello.c
但收到错误消息:
hello.c:47:21: error: GL/glut.h: No such file or directory
hello.c: In function ‘display’:
hello.c:53: error: ‘GL_COLOR_BUFFER_BIT’ undeclared (first use in this function)
hello.c:53: error: (Each undeclared identifier is reported only once
hello.c:53: error: for each function it appears in.)
hello.c:59: error: ‘GL_POLYGON’ undeclared (first use in this function)
hello.c: In function ‘init’:
hello.c:78: error: ‘GL_PROJECTION’ undeclared (first use in this function)
hello.c: In function ‘main’:
hello.c:93: error: ‘GLUT_SINGLE’ undeclared (first use in this function)
hello.c:93: error: ‘GLUT_RGB’ undeclared (first use in this function)
基本上它在抱怨找不到 GL/glut.h。 Mesa不包含相同的头文件吗?
I'm trying to run hello.c from the red book on MAC OS X Lion. I tried to install GLUT by "sudo port install glut" but got the message: Error: glut has been replaced by mesa; please install mesa instead.
So, I installed mesa instead. However, I still can't get my hello.c compiled. I used the following command to compile:
gcc -lglut hello.c
But got the error message:
hello.c:47:21: error: GL/glut.h: No such file or directory
hello.c: In function ‘display’:
hello.c:53: error: ‘GL_COLOR_BUFFER_BIT’ undeclared (first use in this function)
hello.c:53: error: (Each undeclared identifier is reported only once
hello.c:53: error: for each function it appears in.)
hello.c:59: error: ‘GL_POLYGON’ undeclared (first use in this function)
hello.c: In function ‘init’:
hello.c:78: error: ‘GL_PROJECTION’ undeclared (first use in this function)
hello.c: In function ‘main’:
hello.c:93: error: ‘GLUT_SINGLE’ undeclared (first use in this function)
hello.c:93: error: ‘GLUT_RGB’ undeclared (first use in this function)
Basically it's complaining about can't finding GL/glut.h. Doesn't Mesa contain the same header file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
glut 与 mesa 根本不一样,我不知道为什么 macport 这样做...
好消息是你可能不需要安装任何东西:
尝试:(将在 10.6 或 10.7 上工作,你可以其他版本必须调整sdk)
glut isn't the same as mesa at all, I don't know why macport has done this...
Good news is that you probably don't need to install anything:
try:(will work on 10.6 or 10.7, you may have to adjust the sdk for other versions)