使用mingw32在Windows上生成错误 [英] Building glew on windows with mingw32

查看:121
本文介绍了使用mingw32在Windows上生成错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它是重复的,对此我感到抱歉,但是我没有其他选择,因为我无法对答案发表评论,他们也无法解决我的问题.这是原始帖子:

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:

使用mingw在Windows上生成毛刺

这是我的问题:

1)当我尝试@LightningIsMyName的答案时,出现此错误:

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

Makefile:1:***缺少分隔符.停止.

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

2)当我尝试@anon的答案时,出现此错误:

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

Makefile:1:Makefile:1:***命令在第一个目标之前开始.停止.

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.

推荐答案

我在网上进行了太多搜索,无法找到我的问题的答案.我花了很多时间,所以我将其发布在这里以帮助其他人.

I have made too many searching on net to find an answer for my problems. I took a lof ot time so I am posting it here to help others.

要使GLEW与MinGW配合使用,您应该从GLEW网站下载源代码并放置

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

来自MinGW \ bin

gcc.exe 来自MinGW32 \ mingw32 \ bin

gcc.exe from MinGW\bin
ar.exe from MinGW32\mingw32\bin

到GLEW的源文件夹,并在该文件夹中创建并运行.bat,如下所示:

to GLEWs 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

您将在lib文件夹中获取.dll和.a文件.将.dll文件放入system32文件夹,并将.a文件放入MinGW lib文件夹.

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.

首先链接SFML库,然后链接GLEW,最后链接OpenGL.如果更改链接顺序,则会出现链接器错误.

While linking link SFML libraries first then link GLEW and at last link OpenGL. If you change the linking order you will get a linker error.

创建窗口后,别忘了调用glewInit().

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

这篇关于使用mingw32在Windows上生成错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆