title: Programming with OpenGL problems MinGW
body: <p>I tried on eclipse and got the error "Cannot open output file , Permission denied" when trying to use OpenGL. When I used code::blocks - got the same problems as compiling it by myself at the cmd using <code>gcc -o &lt;file_name&gt;.exe &lt;file_name&gt;.c</code>. And all I got was a list full of "undefined reference" to each function appeared in the program taken from OpenGL headers.
  That's the small programs - just printing a red square in the middle.</p>
  
  <pre><code>#include &lt;GL\gl.h&gt;
  #include &lt;GL\glu.h&gt;
  #include &lt;GL\glut.h&gt;
  #include &lt;GL\freeglut.h&gt;
  #include &lt;GL\glext.h&gt;
  #include &lt;GL\freeglut_ext.h&gt;
  #include &lt;GL\freeglut_std.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  #include &lt;math.h&gt;
  #include &lt;windows.h&gt;
  
  void display()
  {
  glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
  glClear(GL_COLOR_BUFFER_BIT);
  //Draw a red 1x1 square in center
  glBegin(GL_QUADS);
  glColor3f(1.0f, 0.0f, 0.0f);
  glVertex2f(-0.5f, -0.5f);    // x, y
  glVertex2f( 0.5f, -0.5f);
  glVertex2f( 0.5f,  0.5f);
  glVertex2f(-0.5f,  0.5f);
  glEnd();
  
  glFlush(); //render now
  }
  
  int main(int argc, char** argv) 
  {
  glutInit(&amp;argc, argv);                 // Initialize GLUT
  glutCreateWindow("OpenGL Setup Test"); // Create a window with the given title
  glutInitWindowSize(320, 320);   // Set the window's initial width &amp; height
  glutInitWindowPosition(50, 50); // Position the window's initial top-left corner
  glutDisplayFunc(display); // Register display callback handler for window re-paint
  glutMainLoop();           // Enter the infinitely event-processing loop
  return 0;
  }
  </code></pre>