Latest Release: 1.13.0


Source Generation
Credits & Copyright
Change Log
Project Page
Bug Tracker

Last Update: 08-10-15
OpenGL Logo
GitHub Logo
SourceForge Logo

The OpenGL Extension Wrangler Library


To use the shared library version of GLEW, you need to copy the headers and libraries into their destination directories. On Windows this typically boils down to copying:

bin/glew32.dll    to     %SystemRoot%/system32
lib/glew32.lib    to     {VC Root}/Lib
include/GL/glew.h    to     {VC Root}/Include/GL
include/GL/wglew.h    to     {VC Root}/Include/GL

where {VC Root} is the Visual C++ root directory, typically C:/Program Files/Microsoft Visual Studio/VC98 for Visual Studio 6.0 or C:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/PlatformSDK for Visual Studio .NET.

On Unix, typing make install will attempt to install GLEW into /usr/include/GL and /usr/lib. You can customize the installation target via the GLEW_DEST environment variable if you do not have write access to these directories.

Building Your Project with GLEW

There are two ways to build your project with GLEW.

Including the source files / project file

The simpler but less flexible way is to include glew.h and glew.c into your project. On Windows, you also need to define the GLEW_STATIC preprocessor token when building a static library or executable, and the GLEW_BUILD preprocessor token when building a dll. You also need to replace <GL/gl.h> and <GL/glu.h> with <glew.h> in your code and set the appropriate include flag (-I) to tell the compiler where to look for it. For example:

#include <glew.h>
#include <GL/glut.h>
<gl, glu, and glut functionality is available here>

Depending on where you put glew.h you may also need to change the include directives in glew.c. Note that if you are using GLEW together with GLUT, you have to include glew.h first. In addition, glew.h includes glu.h, so you do not need to include it separately.

On Windows, you also have the option of adding the supplied project file glew_static.dsp to your workspace (solution) and compile it together with your other projects. In this case you also need to change the GLEW_BUILD preprocessor constant to GLEW_STATIC when building a static library or executable, otherwise you get build errors.

Note that GLEW does not use the C runtime library, so it does not matter which version (single-threaded, multi-threaded or multi-threaded DLL) it is linked with (without debugging information). It is, however, always a good idea to compile all your projects including GLEW with the same C runtime settings.

Using GLEW as a shared library

Alternatively, you can use the provided project files / makefile to build a separate shared library you can link your projects with later. In this case the best practice is to install glew.h, glew32.lib, and glew32.dll / to where the OpenGL equivalents gl.h, opengl32.lib, and opengl32.dll / are located. Note that you need administrative privileges to do this. If you do not have administrator access and your system administrator will not do it for you, you can install GLEW into your own lib and include subdirectories and tell the compiler where to find it. Then you can just replace <GL/gl.h> with <GL/glew.h> in your program:

#include <GL/glew.h>
#include <GL/glut.h>
<gl, glu, and glut functionality is available here>


#include <GL/glew.h>
<gl and glu functionality is available here>

Remember to link your project with glew32.lib, glu32.lib, and opengl32.lib on Windows and,, and on Unix (-lGLEW -lGLU -lGL).

It is important to keep in mind that glew.h includes neither windows.h nor gl.h. Also, GLEW will warn you by issuing a preprocessor error in case you have included gl.h, glext.h, or glATI.h before glew.h.