title: How do I fix the following gcc warnings?
body: <p>I've started learning OpenGL and managed to create a spinning cube using vertex buffer objects. However, when I compile my code, gcc issues the following warnings:</p>
  
  <pre><code>|| sdlogl.c: In function ‘initGL’:
  sdlogl.c|48| warning: implicit declaration of function ‘glGenBuffers’
  sdlogl.c|50| warning: implicit declaration of function ‘glBindBuffer’
  sdlogl.c|51| warning: implicit declaration of function ‘glBufferData’
  </code></pre>
  
  <p>What should I do to fix these warnings?</p>
  
  <p>This is my code:</p>
  
  <pre><code>#include &lt;SDL/SDL.h&gt;
  #include &lt;SDL/SDL_opengl.h&gt;
  #include &lt;GL/gl.h&gt;
  #include &lt;GL/glu.h&gt;
  #include &lt;GL/glext.h&gt;
  
  SDL_Surface *surface;
  float rquad=0.0f;
  GLuint vertexBuffer,colorBuffer;
  
  float vert[]={
       1, 1, 1,   1, 1,-1,  -1, 1,-1,  -1, 1, 1,
       1,-1, 1,   1,-1,-1,  -1,-1,-1,  -1,-1, 1,
       1, 1, 1,   1,-1, 1,   1,-1,-1,   1, 1,-1,
      -1, 1, 1,  -1,-1, 1,  -1,-1,-1,  -1, 1,-1,
       1, 1, 1,  -1, 1, 1,  -1,-1, 1,   1,-1, 1,
       1, 1,-1,  -1, 1,-1,  -1,-1,-1,   1,-1,-1
  };
  float colors[]={
      1,0,0,  1,0,0,  1,0,0,  1,0,0,
      0,1,0,  0,1,0,  0,1,0,  0,1,0,
      0,0,1,  0,0,1,  0,0,1,  0,0,1,
      1,1,0,  1,1,0,  1,1,0,  1,1,0, 
      1,0,1,  1,0,1,  1,0,1,  1,0,1, 
      0,1,1,  0,1,1,  0,1,1,  0,1,1
  };
  
  Uint32 timerfunc(Uint32 interval,void* param){
      rquad+=0.8f;
      return interval;
  }
  
  void initGL(){
  
      glViewport(0,0,640,480);
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      gluPerspective(45,640.0/480.0,0.1,100);
      glMatrixMode(GL_MODELVIEW);
      glLoadIdentity();
  
      glShadeModel(GL_SMOOTH);
      glClearColor(0,0,0,0);
      glClearDepth(1);
      glEnable(GL_DEPTH_TEST);
      glDepthFunc(GL_LEQUAL);
  
      glGenBuffers(1,&amp;vertexBuffer);
      glGenBuffers(1,&amp;colorBuffer);
      glBindBuffer(GL_ARRAY_BUFFER,vertexBuffer);
      glBufferData(GL_ARRAY_BUFFER,72*sizeof(float),vert,
              GL_STATIC_DRAW);
      glBindBuffer(GL_ARRAY_BUFFER,colorBuffer);
      glBufferData(GL_ARRAY_BUFFER,72*sizeof(float),colors,
              GL_STATIC_DRAW);
  }
  
  void drawGLScene(){
      glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
      glLoadIdentity();
      glTranslatef(0,0,-6);
      glRotatef(rquad,1,1,0.5);
  
      glBindBuffer(GL_ARRAY_BUFFER,vertexBuffer);
      glVertexPointer(3,GL_FLOAT,0,0);
      glBindBuffer(GL_ARRAY_BUFFER,colorBuffer);
      glColorPointer(3,GL_FLOAT,0,0);
  
      glEnableClientState(GL_VERTEX_ARRAY);
      glEnableClientState(GL_COLOR_ARRAY);
  
      glDrawArrays(GL_QUADS,0,24);
  
      glDisableClientState(GL_VERTEX_ARRAY);
      glDisableClientState(GL_COLOR_ARRAY);
  
      glBindBuffer(GL_ARRAY_BUFFER,0);
      glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0);
  
      SDL_GL_SwapBuffers();
  }
  
  int main(int argc, char** argv){
      int videoFlags=0;
      videoFlags|=SDL_OPENGL;
      videoFlags|=SDL_GL_DOUBLEBUFFER;
      videoFlags|=SDL_HWPALETTE;
      videoFlags|=SDL_HWSURFACE;
      videoFlags|=SDL_HWACCEL;
  
      int done=0;
      SDL_Event event;
      const SDL_VideoInfo* videoInfo;
  
      SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER);
      videoInfo=SDL_GetVideoInfo();
      SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,1);
  
      SDL_WM_SetCaption("Hello OpenGL!",NULL);
      surface=SDL_SetVideoMode(640,480,32,videoFlags);
  
      initGL();
      SDL_AddTimer(10,timerfunc,NULL);
      while(!done){
          while(SDL_PollEvent(&amp;event)){
              if(event.type==SDL_QUIT){
                  done=1;
              }
          }
          drawGLScene();
      }
      SDL_Quit();
      return 0;
  }
  </code></pre>
  
  <p>In addition, I compile my code using the following command: <code>gcc sdlogl.c -g -Wall -lSDL -lGL -lGLU</code></p>