Skip to content

Building go-gl/gl on Windows

Today I decided I want to continue learning the programming language Go and write a small OpenGL program with it. For OpenGL I wanted to use the Go package “” which usually can be installed with “go get”. This, however, resulted in a bunch of undefined reference errors, because you need to install GLEW beforehand. That on the other hand is not so easy on Windows. While you can download MSVC-compatible .lib files of GLEW and MinGW32 hypothetically can use them, they won’t work for building the gl package (results in other undefined references in the likes of _imp____glew*). Instead, you need to build MinGW32 library files (.a).

Took me some time to figure it out, but these were roughly the steps it required, assuming that Go is already installed:

1. Install MinGW32 and the package mingw32-base
2. Download GLEW source code from
3. Get the build script from
4. Copy the build script into the GLEW source folder and execute it, this will build the library files
5. Copy the static library files (lib/libglew32.a etc.) into your MinGW32 lib folder (e.g. C:\MingW32\lib)
6. Copy the header files (include/GL/glew32.h etc.) into the MingW32 include folder (e.g. C:\MingW32\include\GL)
7. Copy lib/glew32.dll into Windows’ system32 folder
8. go get

After this you should be able to use the gl package.

1 reply »

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: