编译OpenGL和GLUT OSX [英] Compiling OpenGL and GLUT OSX

查看:139
本文介绍了编译OpenGL和GLUT OSX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Mac OSX上使用OpenGL和GLUT框架编译C程序时遇到困难.我才刚刚起步,我尝试运行本教程中有关如何安装OpenGL的代码. http://www.prinmath.com/csci5229/misc/install.html

I am having difficulty compiling a C program using the OpenGL and GLUT frameworks on Mac OSX. I am just getting started and I attempted to run code from this tutorial, on how to install OpenGL. http://www.prinmath.com/csci5229/misc/install.html.

这是代码:

#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

我收到此错误:

foo.c:2:23: error: GLUT/glut.h: No such file or directory

在这里进行了一些进一步的研究后, http://web .eecs.umich.edu/〜sugih/courses/eecs487/glut-howto/,我在/System/Library/Frameworks/中查找了OpenGL.framework和GLUT.framework.

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.

任何帮助将不胜感激!谢谢!

Any help is greatly appreciated! Thank you!

推荐答案

您需要安装OpenGL Utility Toolkit glutg3-dev lib.如果已经存在,请使用-lglut -lGLU -lGL选项进行编译.

You need to install OpenGL Utility Toolkit glutg3-dev lib.If it is already there then compile with -lglut -lGLU -lGL option.

这篇关于编译OpenGL和GLUT OSX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆