编译使用OpenGL的Mac OS X中一个C程序 [英] Compiling a C program that uses OpenGl in Mac OS X
本文介绍了编译使用OpenGL的Mac OS X中一个C程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图编译C程序为我的CS类。我安装我的Mac上的命令行工具,所以我可能有OpenGL的。该计划被描述为Ubuntu制成,它说,对我来说,使用编译:
I am trying to compile a C program for my CS class. I have Command Line tools installed on my Mac, so I probably have OpenGL. The program description was made for Ubuntu and it says for me to compile using:
gcc -Wall -ansi -pedantic -O2 main.o graphic.o imagem.o io.o -o ep2 -lGL -lGLU -lglut
我跑了,它说:
ld: library not found for -lGL
我应该用什么标志?我该怎么办?
What flags should I use? What do I do?
推荐答案
在MacOS X的你不使用库包括系统级的API,但是的框架的。正确的命令行编译这个程序会
In MacOS X you're not using libraries to include system level APIs, but Frameworks. The proper command line to compile this program would be
gcc -Wall -ansi -pedantic -O2 \
main.o graphic.o imagem.o io.o \
-o ep2 \
-framework OpenGL -lGLU -lglut
注意,GLU是大概OpenGL的框架的一部分。它可能需要先安装GLUT。
Note that GLU is probably part of the OpenGL framework as well. And it may be required to install GLUT first.
这篇关于编译使用OpenGL的Mac OS X中一个C程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文