1

我在运行 Makefile 时遇到链接问题。我已经在 cygwin 上安装了 freeglut 并尝试构建我的项目。它在 MSVS 中工作正常,但出现以下错误:

g++ -static obj/MatrixDistortion.o obj/LookAt.o obj/MatrixT.o obj/Matrix2d.o obj/Camera.o obj/Grid.o obj/s_w_project.o obj/Scene.o -o SWproject -L/usr/lib -L/usr/X11/lib -L/lib/cygwin -L/usr/local/lib -lglut -lopengl32 -lglu32
obj/Grid.o:Grid.cpp:(.text+0xa36): undefined reference to `_glPushMatrix'
obj/Grid.o:Grid.cpp:(.text+0xa87): undefined reference to `_glMultMatrixd'
obj/Grid.o:Grid.cpp:(.text+0xaac): undefined reference to `_glTranslatef'
obj/Grid.o:Grid.cpp:(.text+0xab8): undefined reference to `_glClear'
obj/Grid.o:Grid.cpp:(.text+0xad7): undefined reference to `_glColor3f'
obj/Grid.o:Grid.cpp:(.text+0xae3): undefined reference to `_glBegin'
obj/Grid.o:Grid.cpp:(.text+0xb2c): undefined reference to `_glVertex3f'
obj/Grid.o:Grid.cpp:(.text+0xb4f): undefined reference to `_glVertex3f'
obj/Grid.o:Grid.cpp:(.text+0xbb4): undefined reference to `_glVertex3f'
obj/Grid.o:Grid.cpp:(.text+0xbd7): undefined reference to `_glVertex3f'
obj/Grid.o:Grid.cpp:(.text+0xc1e): undefined reference to `_glColor3f'
obj/Grid.o:Grid.cpp:(.text+0xc3d): undefined reference to `_glVertex3f'
obj/Grid.o:Grid.cpp:(.text+0xc5c): undefined reference to `_glVertex3f'
obj/Grid.o:Grid.cpp:(.text+0xc7b): undefined reference to `_glColor3f'
obj/Grid.o:Grid.cpp:(.text+0xc9a): undefined reference to `_glVertex3f'
obj/Grid.o:Grid.cpp:(.text+0xcb9): undefined reference to `_glVertex3f'
obj/Grid.o:Grid.cpp:(.text+0xcd8): undefined reference to `_glColor3f'
obj/Grid.o:Grid.cpp:(.text+0xcf7): undefined reference to `_glVertex3f'
obj/Grid.o:Grid.cpp:(.text+0xd16): undefined reference to `_glVertex3f'
obj/Grid.o:Grid.cpp:(.text+0xd1b): undefined reference to `_glEnd'
obj/Grid.o:Grid.cpp:(.text+0xd20): undefined reference to `_glPopMatrix'
obj/Grid.o:Grid.cpp:(.text+0xd25): undefined reference to `_glFlush'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: obj/Grid.o: bad reloc address 0xd in section `.text$_ZNSt4listIP6CameraSaIS1_EED1Ev[std::list<Camera*, std::allocator<Camera*> >::~list()]'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: final link failed: Invalid operation
collect2: ld returned 1 exit status
Makefile:14: recipe for target `SWproject' failed

从编译器调用中可以看出,我已将库传递给 g++。

我是否必须单独安装 GL,但在这种情况下,为什么我不会收到错误消息#include <GL/gl.h>

4

0 回答 0