这是我的问题:
1)当我尝试@LightningIsMyName的答案时,我会收到此错误:
Makefile:1: *** missing seperator. Stop.
2)当我尝试@anon的答案时,我会收到此错误:
Makefile:1: Makefile:1: *** commands commence before first target. Stop.
人们说这个答案对他们有用,但它们对我没用。我很抱歉我不小心重复了一个问题,但由于评论的限制,我别无选择。希望你能帮忙。谢谢。
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
您将在lib文件夹中获得.dll和.a文件。请将.dll文件放入system32文件夹中,并将.a文件放入MinGW lib文件夹中。
最后,如果您正在使用SFML,请在链接GLEW之前链接SFML库,并在最后链接OpenGL。如果更改链接顺序,则会出现链接器错误。
在创建窗口后不要忘记调用glewInit()函数。
download GLEW source code (not the binaries)
glew.c
source code mine is ~900KB (I think GLEW 1.6)glew.h
header mine is ~900KB (I think GLEW 1.6)I use local project path to store GLEW
I know it is redundant but I do not need to make changes after system changes like reinstall OS or new compiler version etc... but to get it work you need to do some changes inside glew.c
:
#include <glew.h>
to #include "glew.h"
if you want to use global path then add it to your compiler,copy the files there and leave the <>
as are
copy these 2 files to your project
this is how to correctly include it into project just add this to your main source file (where your winmain or main function is):
#include <windows.h> // optional windows
#include <math.h> // optional
#define GLEW_STATIC // this configure header and source of GLEW to compile correctly
#include "glew.c" // header is included inside so no need to duplicate include
// here are the OpenGL includes like: gl.h,glext.h,....
Now it should work
do not forget to call glewInit();
after OpenGL is initialized and before any extension is used ...
请尝试以下命令:
1:gcc -DGLEW_NO_GLU -O2 -Wall -W -Iinclude -DGLEW_BUILD -o src/glew.o -c src/glew.c
2: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
3:ar cr lib/libglew32.a src/glew.o