Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试为我的 CS 类编译一个 C 程序。我在我的 Mac 上安装了命令行工具,所以我可能有 OpenGL。程序描述是为 Ubuntu 制作的,它说我可以使用:
gcc -Wall -ansi -pedantic -O2 main.o graphic.o imagem.o io.o -o ep2 -lGL -lGLU -lglut
我跑了它,它说:
ld: library not found for -lGL
我应该使用什么标志?我该怎么办?
在 MacOS X 中,您使用的不是库来包含系统级 API,而是Frameworks。编译这个程序的正确命令行是
gcc -Wall -ansi -pedantic -O2 \ main.o graphic.o imagem.o io.o \ -o ep2 \ -framework OpenGL -lGLU -lglut
请注意,GLU 也可能是 OpenGL 框架的一部分。并且可能需要先安装 GLUT。
我发现你必须使用
-framework OpenGL -framework GLUT
参考