Home  >  Article  >  Backend Development  >  How do I build GLEW on Windows using Mingw?

How do I build GLEW on Windows using Mingw?

Barbara Streisand
Barbara StreisandOriginal
2024-10-26 07:07:30267browse

How do I build GLEW on Windows using Mingw?

Building glew on Windows with Mingw

To construct glew on Windows using Mingw, utilize the following commands:

mkdir lib/
mkdir bin/
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

For creating the library file:

ar cr lib/libglew32.a src/glew.o

And the pkg-config file:

sed \
-e "s|@prefix@|/usr|g" \
-e "s|@libdir@|/usr/lib|g" \
-e "s|@exec_prefix@|/usr/bin|g" \
-e "s|@includedir@|/usr/include/GL|g" \
-e "s|@version@|1.6.0|g" \
-e "s|@cflags@||g" \
-e "s|@libname@|GLEW|g" \
< glew.pc.in > glew.pc

For building the glew visualinfo program, you can use these:

gcc -c -O2 -Wall -W -Iinclude -o src/glewinfo.o src/glewinfo.c
gcc -O2 -Wall -W -Iinclude -o bin/glewinfo.exe src/glewinfo.o -Llib -lglew32 -L/mingw/lib -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32
gcc -c -O2 -Wall -W -Iinclude -o src/visualinfo.o src/visualinfo.c
gcc -O2 -Wall -W -Iinclude -o bin/visualinfo.exe src/visualinfo.o -Llib -lglew32 -L/mingw/lib -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32

After executing these commands, you will have a 'lib' folder and a 'bin' folder containing the necessary executables and libraries.

The above is the detailed content of How do I build GLEW on Windows using Mingw?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn