Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

It is a duplicate and I am sorry about it but I don't have any other options because I can't make comments on answers and they didn't solved my problem. Here is the original post:

Building glew on windows with mingw

And here is my problem:

1) When I try @LightningIsMyName's answer I get this error:

Makefile:1: *** missing seperator. Stop.

2) When I try @anon's answer I get this error:

Makefile:1: Makefile:1: *** commands commence before first target. Stop.

People says this andswer helped them but they didn't worked for me. I apogilize I duplicae a question somehow but I have no other chance with reputation limit for commenting. Hope you help. Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
366 views
Welcome To Ask or Share your Answers For Others

1 Answer

I have performed many searches in order to find an answer to my problems. It took a lot of time so I am posting it here to help others.

To make GLEW work with MinGW you should download the source from GLEW website and put

gcc.exe from MinGWin
ar.exe from MinGW32mingw32in

to GLEW's source folder and create and run a .bat in that folder like that:

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 will get your .dll and .a files in lib folder. Put .dll files to system32 folder and put .a files to MinGW lib folder.

Finally, if you are using SFML, link SFML libraries before GLEW and at last link OpenGL. If you change the linking order you will get a linker error.

Don't forget to call glewInit() after creating your window.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...