使用Eclipse 3.6.2,當前版本的CDT,當前的Cygwin工具和C++(GCC)編譯器。鏈接-lglu32,-lglut32,-lopengl32。Windows上的Eclipse中的OpenGL,設置幫助w /鏈接錯誤?
我試圖讓這個環境中建立對OpenGL開發和正在運行到鏈接,我一直未能解決的錯誤。相關OpenGL和過剩庫和頭文件的最新版本已被複制到C:\ Cygwin的\ lib和C:\ Cygwin的的\ usr \包括\ w32api
例如,而這個編譯和鏈接..
#include <windows.h>
#include <GLES2/gl2.h>
#include <EGL/egl.h>
#include <GL/glut.h>
[...]
void display() {
glClear(GL_COLOR_BUFFER_BIT); /* Clear the screen with the clear color */
glBegin(GL_TRIANGLES);
glVertex3f(-0.5,-0.5,0.0);
glVertex3f(0.5,0.0,0.0);
glVertex3f(0.0,0.5,0.0);
glEnd();
glutSwapBuffers();
}
以下代碼在glVertextAttribPointer,glEnableVertexAttribArray和glDisableVertexAttribArray方法中拋出未定義的引用錯誤。
void display() {
glClear(GL_COLOR_BUFFER_BIT); /* Clear the screen with the clear color */
// map the border vertices
glVertexAttribPointer(crosshairVertexHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &crossVertices[0]);
glEnableVertexAttribArray(crosshairVertexHandle);
glLineWidth(2.0f);
glDrawArrays(GL_LINES, 0, 4);
glDisableVertexAttribArray(crosshairVertexHandle);
glutSwapBuffers(); /* Double buffering */
}
這裏的錯誤。對於項目
構建配置調試的ogl_tests **
make all
Building file: ../src/ogl_tests.cpp
Invoking: Cygwin C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/ogl_tests.d" -MT"src/ogl_tests.d" -o"src/ogl_tests.o" "../src/ogl_tests.cpp"
Finished building: ../src/ogl_tests.cpp
Building target: ogl_tests.exe
Invoking: Cygwin C++ Linker
g++ -o"ogl_tests.exe" ./src/ogl_tests.o -lglu32 -lglut32 -lopengl32
./src/ogl_tests.o: In function `_Z7displayv':
/cygdrive/c/Users/David/workspace/ogl_tests/Debug/../src/ogl_tests.cpp:61: undefined reference to `[email protected]'
/cygdrive/c/Users/David/workspace/ogl_tests/Debug/../src/ogl_tests.cpp:62: undefined reference to `[email protected]'
/cygdrive/c/Users/David/workspace/ogl_tests/Debug/../src/ogl_tests.cpp:67: undefined reference to `[email protected]'
collect2: ld returned 1 exit status
make: *** [ogl_tests.exe] Error 1
任何想法? - 我使用的cygwin路徑是否正確?
忘了提及這是一個Vista 64系統。 – olo