I've attempted to follow the instructions from various places [1][2][3], but I keep getting link errors when attempting to use GLUT and OpenGL in Cygwin. Everything I try gives me a link error similar to:
$g++ -Wall -pedantic -c -o triangle.o triangle.cpp
$g++ -o triangle *.o -lglut32 -lglu32 -lopengl32 -o triangle
triangle.o:triangle.cpp:(.text+0x1c): undefined reference to `___glutInitWithExit'
...
triangle.o:triangle.cpp:(.text+0x11c): undefined reference to `_glClear'
...
I have tried C (gcc) and C++ (g++), with and without -mno-cygwin, with various combinations of Cygwin's opengl, libglut-devel, and w32api packages. (I am trying to do this without using X11 if possible.)
Am I doing something wrong here? The instructions on the other stackoverflow links look so simple that I don't know how I could be messing this up.
Thanks in advance.
[1] http://stackoverflow.com/questions/14344/starting-off-with-opengl-under-cygwin
[2] http://stackoverflow.com/questions/389488/compiling-minimal-glew-application-under-cygwin
[3] http://cygwin.com/ml/cygwin/2010-09/msg00238.html