title: Primitive Restart Index error in C++ with OpenGL
body: <p>I'm just learning OpenGl and trying to implement a simple test of how the Primitive Restart Index works. No matter what I try, g++ gives me the error "undefined reference to `__glewPrimitiveRestartIndex'."</p>
  
  <p>Here's the code in question:</p>
  
  <pre><code>#include &lt;GL/glew.h&gt;
  #include &lt;GL/freeglut.h&gt;
  
  static GLfloat vertices[] = {0.0, 0.0, 0.0, 5.0, -5.0, 0.0,
  0xffff, 0.0, -10.0, 5.0, -15.0, 6.0, -8.0};
  
  void init(void)
  {
      glEnable(GL_PRIMITIVE_RESTART);
      glPrimitiveRestartIndex(0xffff);
  
      glEnableClientState(GL_VERTEX_ARRAY);
      glVertexPointer(2, GL_FLOAT, 0, vertices);
  }
  </code></pre>
  
  <p>I admit that I'm a bit new to using g++, and don't fully understand its switch and include mechanisms. The g++ command I'm using to compile it is as follows:
      g++ -o test test.cpp -lGL -lglut</p>
  
  <p>Upon appending "-lGLEW" to the command, the program compiles but hands me a segfault. Removing the line "glPrimitiveRestartIndex(0xffff);" from the code makes it compile and run without fault (of course, without the primitive restart index working) when -lGLEW is appended to the compile command, but hands the same error when trying without.</p>
  
  <p>This leads me to believe that the initial problem results from not having included -lGLEW - so the only remaining issue is figuring out why I'm being handed a segfault. I've tried with different values other than 0xffff, but the problem remains.</p>