title: Linking GLEW libraries when compiling with MinGW
body: <p>I'm trying to write an OpenGL program which I'm compiling through MinGW. I've managed to successfully link OpenGL, GLUT, GLFW and GLM to my main.cpp file. Given the following headers:</p>
  
  <pre><code>#include "GL/glut.h"
  #include "GLFW/glfw3.h"
  #include "GL/glew.h"
  #include "glm/vec3.hpp"
  </code></pre>
  
  <p>And the following cmd line:</p>
  
  <pre><code>g++ -o leaf.exe -Wall physics.cpp -mwindows lib/glut32.lib -lopengl32 -lglu32 -lglfw3dll -lglew32 -IC:/MinGW/include/GL
  </code></pre>
  
  <p>I manage to get it to compile successfully. However, when placing the .a files in MinGW/lib, the .dll file in source folder and the .h file in C:\MinGW\include and adding</p>
  
  <pre><code>#include "GL/glew.h"
  </code></pre>
  
  <p>With the following command line</p>
  
  <pre><code>g++ -o leaf.exe -Wall physics.cpp -mwindows lib/glut32.lib -lopengl32 -lglu32 -lglfw3dll -lglew32 -IC:/MinGW/include/GL
  </code></pre>
  
  <p>Then I get a long list of errors including:</p>
  
  <pre><code>In file included from physics.cpp:6:0:
  c:\mingw\include\gl\glew.h:85:2: error: #error gl.h included before glew.h
  #error gl.h included before glew.h
  
  In file included from physics.cpp:6:0:
  c:\mingw\include\gl\glew.h:1814:94: error: 'GLchar' does not name a type
  typedef void (GLAPIENTRY * PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar* name);
  </code></pre>
  
  <p>My first time trying to make something without using Visual Studio or Eclipse. Been trying lots of fixes for it I've found here but nothing concrete.</p>
  
  <p>Thanks for reading this far!</p>