我一直在使用预设置代码块项目在Ubuntu 16.04机器上运行我的OpenGL代码。直到最近我发现该项目无法编译为止,它一直可以正常工作。这是构建日志。
-------------- Build: Debug in OpenGL (compiler: GNU GCC Compiler)---------------
g++ -L"C:/Users/mrahman/Documents/CodeBlocks Projects/OpenGL/OpenGL/lib" -LOpenGL/include -o bin/Debug/OpenGL obj/Debug/main.o OpenGL/lib/Glaux.lib OpenGL/lib/GLU32.LIB OpenGL/lib/glui32.lib OpenGL/lib/glut32.lib OpenGL/lib/OPENGL32.LIB OpenGL/lib/Glaux.lib OpenGL/lib/GLU32.LIB OpenGL/lib/glui32.lib OpenGL/lib/glut32.lib OpenGL/lib/OPENGL32.LIB
obj/Debug/main.o: In function `drawAxes()':
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:37: undefined reference to `glColor3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:38: undefined reference to `glBegin'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:39: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:40: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:42: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:43: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:45: undefined reference to `glVertex3f'
obj/Debug/main.o:/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:46: more undefined references to `glVertex3f' follow
obj/Debug/main.o: In function `drawAxes()':
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:47: undefined reference to `glEnd'
obj/Debug/main.o: In function `drawGrid()':
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:57: undefined reference to `glColor3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:58: undefined reference to `glBegin'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:65: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:66: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:69: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:70: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:72: undefined reference to `glEnd'
obj/Debug/main.o: In function `drawSquare(double)':
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:79: undefined reference to `glBegin'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:80: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:81: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:82: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:83: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:84: undefined reference to `glEnd'
obj/Debug/main.o: In function `drawCircle(double, int)':
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:92: undefined reference to `glColor3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:102: undefined reference to `glBegin'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:104: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:105: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:107: undefined reference to `glEnd'
obj/Debug/main.o: In function `drawCone(double, double, int)':
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:128: undefined reference to `glColor3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:130: undefined reference to `glBegin'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:132: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:133: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:134: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:136: undefined reference to `glEnd'
obj/Debug/main.o: In function `drawSphere(double, int, int)':
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:161: undefined reference to `glColor3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:164: undefined reference to `glBegin'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:166: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:167: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:168: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:169: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:171: undefined reference to `glVertex3f'
obj/Debug/main.o:/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:172: more undefined references to `glVertex3f' follow
obj/Debug/main.o: In function `drawSphere(double, int, int)':
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:175: undefined reference to `glEnd'
obj/Debug/main.o: In function `drawQuarterSpere(double)':
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:200: undefined reference to `glColor3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:205: undefined reference to `glBegin'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:207: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:208: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:209: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:210: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:211: undefined reference to `glEnd'
obj/Debug/main.o: In function `drawQuarterSpereDown(double)':
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:236: undefined reference to `glColor3f'
Process terminated with status 1 (0 minute(s), 0 second(s))
50 error(s), 0 warning(s) (0 minute(s), 0 second(s))
我猜这是问题所在。
g ++ -L“ C:/ Users / mrahman / Documents / CodeBlocks项目/ OpenGL / OpenGL / lib”
该目录不在我的计算机中。已经搜索了代码块设置,但找不到该目录的设置位置。
找到该目录的设置位置。删除了。只是没有这个错误
-L“ C:/ Users / mrahman / Documents / CodeBlocks项目/ OpenGL / OpenGL / lib” 部分。
-------------- Build: Debug in OpenGL (compiler: GNU GCC Compiler)---------------
g++ -Wall -fexceptions -g -IOpenGL/include -IOpenGL/include -IOpenGL/lib -c "/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp" -o obj/Debug/main.o
In file included from /media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:6:0:
OpenGL/include/glut.h:151:0: warning: "APIENTRY" redefined
# define APIENTRY
^
In file included from OpenGL/include/glut.h:137:0,
from /media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:6:
/usr/include/GL/gl.h:88:0: note: this is the location of the previous definition
#define APIENTRY GLAPIENTRY
^
g++ -LOpenGL/include -o bin/Debug/OpenGL obj/Debug/main.o OpenGL/lib/Glaux.lib OpenGL/lib/GLU32.LIB OpenGL/lib/glui32.lib OpenGL/lib/glut32.lib OpenGL/lib/OPENGL32.LIB OpenGL/lib/Glaux.lib OpenGL/lib/GLU32.LIB OpenGL/lib/glui32.lib OpenGL/lib/glut32.lib OpenGL/lib/OPENGL32.LIB
obj/Debug/main.o: In function `drawAxes()':
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:37: undefined reference to `glColor3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:38: undefined reference to `glBegin'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:39: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:40: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:42: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:43: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:45: undefined reference to `glVertex3f'
obj/Debug/main.o:/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:46: more undefined references to `glVertex3f' follow
obj/Debug/main.o: In function `drawAxes()':
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:47: undefined reference to `glEnd'
obj/Debug/main.o: In function `drawGrid()':
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:57: undefined reference to `glColor3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:58: undefined reference to `glBegin'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:65: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:66: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:69: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:70: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:72: undefined reference to `glEnd'
obj/Debug/main.o: In function `drawSquare(double)':
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:79: undefined reference to `glBegin'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:80: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:81: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:82: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:83: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:84: undefined reference to `glEnd'
obj/Debug/main.o: In function `drawCircle(double, int)':
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:92: undefined reference to `glColor3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:102: undefined reference to `glBegin'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:104: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:105: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:107: undefined reference to `glEnd'
obj/Debug/main.o: In function `drawCone(double, double, int)':
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:128: undefined reference to `glColor3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:130: undefined reference to `glBegin'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:132: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:133: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:134: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:136: undefined reference to `glEnd'
obj/Debug/main.o: In function `drawSphere(double, int, int)':
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:161: undefined reference to `glColor3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:164: undefined reference to `glBegin'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:166: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:167: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:168: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:169: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:171: undefined reference to `glVertex3f'
obj/Debug/main.o:/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:172: more undefined references to `glVertex3f' follow
obj/Debug/main.o: In function `drawSphere(double, int, int)':
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:175: undefined reference to `glEnd'
obj/Debug/main.o: In function `drawQuarterSpere(double)':
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:200: undefined reference to `glColor3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:205: undefined reference to `glBegin'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:207: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:208: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:209: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:210: undefined reference to `glVertex3f'
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:211: undefined reference to `glEnd'
obj/Debug/main.o: In function `drawQuarterSpereDown(double)':
/media/shahad/633AACAB78E84EA7/4-2/Graphics lab/Offline 4/Offline/OpenGL_CodeBlocks/main.cpp:236: undefined reference to `glColor3f'
Process terminated with status 1 (0 minute(s), 1 second(s))
50 error(s), 1 warning(s) (0 minute(s), 1 second(s))