For some reason I had a tough time building the GLEW (OpenGL Extension Wrangler Library – as of this writing the most recent version is 1.10.0). I needed it to pair up with SFML and I wanted to use MinGW’s compiler, and for some reason, the developers of GLEW only provided the pre-compiled libraries for VC++.
I stumbled upon this stackoverflow post, which… didn’t work for me by just copy pasting the whole thing to my command prompt ): . So this is what I did to get it working (assuming you have MinGW’s bin directory in your environment paths).
cd to the root directory and execute these line by line:
mkdir lib gcc -DGLEW_NO_GLU -O2 -Wall -W -Iinclude -DGLEW_BUILD -o src/glew.o -c src/glew.c gcc -shared -Wl,-soname,libglew32.dll -Wl,--out-implib,lib/libglew32.dll.a -o lib/glew32.dll src/glew.o -L/mingw/lib -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32 ar cr lib/libglew32.a src/glew.o gcc -DGLEW_NO_GLU -DGLEW_MX -O2 -Wall -W -Iinclude -DGLEW_BUILD -o src/glew.mx.o -c src/glew.c gcc -shared -Wl,-soname,libglew32mx.dll -Wl,--out-implib,lib/libglew32mx.dll.a -o lib/glew32mx.dll src/glew.mx.o -L/mingw/lib -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32 ar cr lib/libglew32mx.a src/glew.mx.o
You should find the *.dll and *.a files in the lib folder. Takes only a few seconds to build in my laptop.
For those who are lazy, here’s the pre-compiled libraries for MinGW (MinGW 4.8.6, GCC 4.8.1, GLEW 1.10.0, Windows 8.1): download link [mediafire]
finally! thanks VERY MUCH!
LikeLiked by 1 person
You’re a pimp and a cool! THANKS
LikeLike
Things seem to have improved since then 🙂
I’ve just been able to install GLEW in my MinGW using MSYS :
* make -j
* GLEW_DEST=/mingw make install
LikeLike
Thanks so much bruceoutdoors! Saved me a lot of time!
LikeLike
mostraba errores al usar la palabra “gcc” y “ar”, lo solucione con esto.
“C:\Program Files (x86)\CodeBlocks\MinGW\bin\gcc.exe”
“C:\Program Files (x86)\CodeBlocks\MinGW\bin\ar.exe”
MUCHAS GRACIAS AMIGO, tenia horas buscando esto 🙂
LikeLike
THANK YOU!!!!!!!!!!!!
LikeLike
Getting linker errors
undefined reference to ‘wglGetProcAddress@4’
LikeLike
Thanks for this article! I had to use -nostdlib flag to get rid of multiple definition of DllCRTMainStartup@12 as explained here: https://stackoverflow.com/questions/38673228/multiple-definition-of-dllmaincrtstartup12-while-building-glew-on-windows-wit
LikeLike
Thank you so much!
LikeLike