title: Freeglut error: fgInitGL2: fghGenBuffers is NULL
body: <p>I'm transferring a program from OSX to Windows, but one error is still nagging me. The error occurs during run-time in gdb. Compiling and linking goes all fine.</p>
  
  <blockquote>
    <p>freeglut (C:\path\to\file.exe): fgInitGL2: fghGenBuffers is NULL</p>
  </blockquote>
  
  <p>Outside the GDB environment it gives an APPCRASH (windows-shell) or Segmentation fault (mingw64-shell).</p>
  
  <p>My linker flags are:</p>
  
  <blockquote>
    <p>-std=c++11 -lstdc++ -lz -lm -lmysqlcleint -lpthread -lboost_thread-mgw49-mt-d-1_57 -lboost_system-mgw49-mt-d-1_57 -lboost_regex-mgw49-mt-d-1_57 -lcurl -lfreeglut -lglu32 -lopengl32 -lws2_32 -lwsock32 -U__CYGWIN__</p>
  </blockquote>
  
  <p>I'm working in msys2 mingw-w64. During runtime, the program tries to open a new window (at least a pictogram rices in the windows taskbar), but the construction of the window won't succeed. The program runs fine on OSX, where I use glut instead of freeglut.</p>
  
  <p>Header (amongst others):</p>
  
  <pre><code>#include &lt;direct.h&gt;
  #include &lt;GL/glut.h&gt;
  #include &lt;GL/freeglut.h&gt;
  </code></pre>
  
  <p>CPP (amongst others):</p>
  
  <pre><code>void interface::startInterface(int &amp;argc, char **argv){
  
      glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
      glutInitWindowSize  (width, height);
      glutInitWindowPosition (1920, 0);
      glutInit            (&amp;argc, argv);
      glutCreateWindow    ("TIFAR 2.0");
  
  
      LoadGLTextures();                           // Load The Texture(s) ( NEW )
      glClearColor(0.0f, 0.0f, 0.0f, 0.0f);       // This Will Clear The Background Color To Black
      glClearDepth(1.0);                          // Enables Clearing Of The Depth Buffer
      glDepthFunc(GL_LESS);                       // The Type Of Depth Test To Do
      glEnable(GL_DEPTH_TEST);                    // Enables Depth Testing
      glEnable(GL_BLEND);
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
      glShadeModel(GL_SMOOTH);                    // Enables Smooth Color Shading
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();                           // Reset The Projection Matrix
  
      gluPerspective(45.0f, (GLfloat) width / (GLfloat) height, 0.1f, 100.0f);
      // Calculate The Aspect Ratio Of The Window
  
      glMatrixMode(GL_MODELVIEW);
  
      glutDisplayFunc     (interface::display);
      glutReshapeFunc     (interface::reshape);
      glutIdleFunc        (interface::idle);
      glutKeyboardFunc    (interface::processNormalKeys);
  
      glutMainLoop();
  }
  </code></pre>
  
  <p>There are some other parts in the program, like where images are loaded, but I think it will be to much information when I mention everything here.</p>