Using Eclipse 3.6.2, current version of CDT, current Cygwin tools and C++ (GCC) compiler. Linking -lglu32, -lglut32, -lopengl32.
I'm trying to get this environment set-up for OpenGL development and am running into linking errors that I've been unable to resolve. Current versions of the relevant opengl and glut libs and headers have been copied to C:\cygwin\lib and C:\cygwin\usr\include\w32api
For example while this compiles and links ..
#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();
}
the following throws undefined reference errors on glVertextAttribPointer, glEnableVertexAttribArray and 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 */
}
Here's the error..
Build of configuration Debug for project 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 `__imp__glVertexAttribPointer@24'
/cygdrive/c/Users/David/workspace/ogl_tests/Debug/../src/ogl_tests.cpp:62: undefined reference to `__imp__glEnableVertexAttribArray@4'
/cygdrive/c/Users/David/workspace/ogl_tests/Debug/../src/ogl_tests.cpp:67: undefined reference to `__imp__glDisableVertexAttribArray@4'
collect2: ld returned 1 exit status
make: *** [ogl_tests.exe] Error 1
Any ideas?? - are the cygwin paths that I'm using correct?