title: How to use OpenGL and GLUT in Cygwin
body: <p>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:</p>
  
  <pre><code>$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'
  ...
  </code></pre>
  
  <p>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.)</p>
  
  <p>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.</p>
  
  <p>Thanks in advance.</p>
  
  <p>[1] <a href="https://stackoverflow.com/questions/14344/starting-off-with-opengl-under-cygwin">Starting off with OpenGL under Cygwin</a><br>
  [2] <a href="https://stackoverflow.com/questions/389488/compiling-minimal-glew-application-under-cygwin">Compiling minimal GLEW application under Cygwin</a><br>
  [3] <a href="http://cygwin.com/ml/cygwin/2010-09/msg00238.html" rel="nofollow noreferrer">http://cygwin.com/ml/cygwin/2010-09/msg00238.html</a></p>