glGetStringi how make it work?

I want to know the opengl extensions, using glGetStringi, but the code doesn’t compile. What the include for glGetStringi?
I’m using Code::Blocks with mingw on windows 7.

My code:

#include <iostream>
#include “GL/gl.h”
#include <windows.h>

using namespace std;

int main()
int max = 0;
glGetIntegerv(GL_EXTENSIONS, &max);

for(int i = 0; i &lt; max; i++)
    cout &lt;&lt; glGetStringi(GL_EXTENSIONS, i) &lt;&lt; endl;

return 0;


Care to share the actual compiler error? :confused:

The error is:
‘glGetStringi’ was not declared in this scope

Ah yes, glGetStringi is a GL 3.0 or higher function IIRC. The standard GL header shipped with Windows, however, exposes only GL 1.1 functionality. Checkout glLoadGen or GLEW.

Correction: Your header is shipped with MinGW. Still, MinGW’s gl.h doesn’t expose GL 3.0 or higher functions. The advice stays the same.

glGetStringi was only added to OpenGL in version 3.0, and the gl.h provided by Microsoft only includes OpenGL 1.1 entry points, so you will need to include extra code to the retrieve the function pointers, or use tools that do this for you

I got GLEW_OK on glewInit, but glGetStringi don’t compile, I got undefined reference. What shall be wrong?
glewExperimental is a undefined reference too.

I am not sure what glew you are using but glGetStringi works find for me. Check your glew.h.

You’re getting linker errors because you’re probably linking with the wrong libraries (or not linking with them at all). Honestly, if you want this to be much simpler, just use glLoadGen and include the source/headers into your project directly.

I added glew source files to my project and it worked. Now I can call the extensions!
Thank you =)