Matt Johnson
hello world
Fix Compiler Warnings in OpenGL on Linux
Posted Sat Oct 01 @ 07:06:27 PM PDT 2011
Here are all the nice warnings GCC gives me when I try to compile an OpenGL program:
warning: implicit declaration of function "glGenBuffers"
warning: implicit declaration of function "glBindBuffer"
warning: implicit declaration of function "glBufferData"
warning: implicit declaration of function "glCreateShader"
warning: implicit declaration of function "glShaderSource"
warning: implicit declaration of function "glCompileShader"
warning: implicit declaration of function "glGetShaderiv"
warning: implicit declaration of function "glGetShaderInfoLog"
warning: implicit declaration of function "glCreateProgram"
warning: implicit declaration of function "glAttachShader"
warning: implicit declaration of function "glLinkProgram"
warning: implicit declaration of function "glGetProgramiv"
warning: implicit declaration of function "glGetProgramInfoLog"
warning: implicit declaration of function "glGetUniformLocation"
warning: implicit declaration of function "glUseProgram"
warning: implicit declaration of function "glUniform2f"
warning: implicit declaration of function "glUniform3f"
To fix it, add:
#define GL_GLEXT_PROTOTYPES
before your includes:
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include <GL/gl.h>
#include <GL/glu.h>
That should do it.