title: "Undefined reference to _ms_vsnprintf"
body: <p><strong>I figured out what I did. It was one of the libraries I was using. It had a reference to <code>_ms__vsnprintf</code> that wasn't defined in it. I removed the file and my program compiled. Thanks for your help.
  For future reference, the file was <code>libglfw3.a</code>.</strong></p>
  
  <p>How do I fix the error "Undefined Reference to _ms_vsnprintf"? I've only seen one other post about it, and that didn't fix my problem. I'm using Windows 8, Code::Blocks and MinGW. This is my code. </p>
  
  <pre><code>#define __LCC__
  #define GLEW_STATIC
  #define GLFWAPI __declspec(dllimport)
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;GL/glew.h&gt;
  #define GLFW_INCLUDE_GLU
  #include &lt;GL/glfw3.h&gt;
  #include &lt;glm/glm.hpp&gt;
  using namespace glm;
  int main() {
  if( !glfwInit() ) {
      fprintf( stderr, "Failed to initialize GLFW\n");
      return -1;
  }
   glfwWindowHint(GLFW_SAMPLES, 4);
   glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
   glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
   glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
  glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
  
  GLFWwindow* window;
  window = glfwCreateWindow( 600, 800, "OpenGL Window", NULL, NULL);
  
  if(window == NULL) {
      fprintf(stderr, "OpenGL Couldn't open the window.\n");
      glfwTerminate();
      return -1;
  }
  
  glfwMakeContextCurrent(window);
  glewExperimental=true;
  if (glewInit() !=GLEW_OK) {
      fprintf(stderr, "Failed to start GLEW.\n");
      return -1;
  }
   }
  </code></pre>
  
  <p>Here's the build log from Code::Blocks</p>
  
  <pre><code>-------------- Build: Debug in opengltest (compiler: GNU GCC Compiler)---------------
  
  mingw32-g++.exe -lglfw3 -Wall -g -I..\..\MiniGW\lib\lib-mingw-w64 -c "D:\Programs\C PROGRAMS\opengltest\main.cpp" -o obj\Debug\main.o
  mingw32-g++.exe -L..\..\MiniGW\lib\lib-mingw-w64 -L..\MiniGW\lib -o bin\Debug\opengltest.exe obj\Debug\main.o  -lglfw3 -lglfw3 -lopengl32 -lgdi32 -lglu32  ..\..\MiniGW\lib\Release\Win32\glew32s.lib ..\..\MiniGW\lib\lib-mingw-w64\glfw3dll.a ..\..\MiniGW\lib\lib-mingw-w64\libglfw3.a ..\..\MiniGW\lib\libglu32.a ..\..\MiniGW\lib\libopengl32.a
  Warning: corrupt .drectve at end of def file
  ..\..\MiniGW\lib\lib-mingw-w64/libglfw3.a(init.c.obj):init.c:(.text+0x49): undefined reference to `__ms_vsnprintf'
  collect2.exe: error: ld returned 1 exit status
  Process terminated with status 1 (0 minute(s), 13 second(s))
  1 error(s), 1 warning(s) (0 minute(s), 13 second(s))
  </code></pre>