2013-08-26 63 views
1

我正在編譯C++文件和頭文件的目錄。我以爲我正確安裝了OpenGL,Glut和Glew,但在運行時我一直在引用錯誤。在Ubuntu終端中編譯時引用OpenGL的問題

下面是我在做什麼和錯誤,編譯器正在發回給我:

[email protected]:~/Documents/HW$ make 
g++ -g framework.o poly_line.o shader_program.o circle.o controller.o main.o scene.o view.o -lGLEW -lglut -lGLU -o HW 
framework.cpp:84: error: undefined reference to 'glGetError' 
check_gl.h:30: error: undefined reference to 'glGetError' 
check_gl.h:43: error: undefined reference to 'glGetError' 
poly_line.cpp:23: error: undefined reference to 'glGenBuffers' 
poly_line.cpp:28: error: undefined reference to 'glBindBuffer' 
poly_line.cpp:29: error: undefined reference to 'glBufferData' 
poly_line.cpp:54: error: undefined reference to 'glEnable' 
poly_line.cpp:55: error: undefined reference to 'glEnable' 
poly_line.cpp:56: error: undefined reference to 'glBlendFunc' 
poly_line.cpp:57: error: undefined reference to 'glHint' 
poly_line.cpp:59: error: undefined reference to 'glDisable' 
poly_line.cpp:60: error: undefined reference to 'glDisable' 
poly_line.cpp:68: error: undefined reference to 'glBindBuffer' 
poly_line.cpp:69: error: undefined reference to 'glEnableVertexAttribArray' 
poly_line.cpp:70: error: undefined reference to 'glVertexAttribPointer' 
poly_line.cpp:78: error: undefined reference to 'glDrawArrays' 
poly_line.cpp:80: error: undefined reference to 'glDrawArrays' 
shader_program.cpp:104: error: undefined reference to 'glCreateProgram' 
shader_program.cpp:113: error: undefined reference to 'glGetProgramiv' 
shader_program.cpp:115: error: undefined reference to 'glGetProgramiv' 
shader_program.cpp:120: error: undefined reference to 'glGetProgramInfoLog' 
shader_program.cpp:135: error: undefined reference to 'glGetShaderiv' 
shader_program.cpp:137: error: undefined reference to 'glGetShaderiv' 
shader_program.cpp:142: error: undefined reference to 'glGetShaderInfoLog' 
shader_program.cpp:155: error: undefined reference to 'glDeleteShader' 
shader_program.cpp:163: error: undefined reference to 'glDeleteShader' 
shader_program.cpp:185: error: undefined reference to 'glCreateShader' 
shader_program.cpp:195: error: undefined reference to 'glShaderSource' 
shader_program.cpp:200: error: undefined reference to 'glCompileShader' 
shader_program.cpp:214: error: undefined reference to 'glAttachShader' 
shader_program.cpp:219: error: undefined reference to 'glLinkProgram' 
shader_program.cpp:238: error: undefined reference to 'glUseProgram' 
shader_program.cpp:249: error: undefined reference to 'glUniform1f' 
shader_program.cpp:257: error: undefined reference to 'glUniform1i' 
shader_program.cpp:270: error: undefined reference to 'glGetUniformLocation' 
shader_program.cpp:290: error: undefined reference to 'glUseProgram' 
shader_program.cpp:304: error: undefined reference to 'glGetProgramiv' 
shader_program.cpp:308: error: undefined reference to 'glGetProgramiv' 
shader_program.cpp:315: error: undefined reference to 'glGetActiveUniform' 
view.cpp:28: error: undefined reference to 'glClearColor' 
view.cpp:29: error: undefined reference to 'glClear' 
collect2: error: ld returned 1 exit status 
make: *** [HW] Error 1 

回答

7

有鏈接到的一切,但在這個例子中,廚房水槽,但忘了OpenGL庫本身。

GL添加到您的Makefile中的庫列表。另外,請確保最後鏈接它。