我已尝试按照各个地方的说明进行操作 [1][2][3],但在 Cygwin 中尝试使用 GLUT 和 OpenGL 时,我总是遇到链接错误。我尝试的所有操作都会给我一个类似于以下内容的链接错误:
$g++ -Wall -pedantic -c -o triangle.o triangle.cpp
$g++ -o triangle *.o -lglut32 -lglu32 -lopengl32 -o triangle
triangle.o:triangle.cpp:(.text+0x1c): undefined reference to `___glutInitWithExit'
...
triangle.o:triangle.cpp:(.text+0x11c): undefined reference to `_glClear'
...
我尝试过 C (gcc) 和 C++ (g++),有和没有 -mno-cygwin,以及 Cygwin 的 opengl、libglut-devel 和 w32api 包的各种组合。 (如果可能的话,我试图在不使用 X11 的情况下执行此操作。)
我是不是做错了什么?其他 stackoverflow 链接上的说明看起来非常简单,我不知道我怎么会把它搞砸。
提前致谢。
[1] Starting off with OpenGL under Cygwin
[2] Compiling minimal GLEW application under Cygwin
[3] http://cygwin.com/ml/cygwin/2010-09/msg00238.html
最佳答案
该错误表明您在包含 .另请参阅 this 的答案问题。
关于c++ - 如何在 Cygwin 中使用 OpenGL 和 GLUT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3818640/