使用 mingw32 在窗户上发光

Building glew on windows with mingw32(使用 mingw32 在窗户上发光)
本文介绍了使用 mingw32 在窗户上发光的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

这是重复的,我很抱歉,但我没有任何其他选择,因为我无法对答案发表评论,他们也没有解决我的问题.以下是原帖:

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 上构建 glew

这是我的问题:

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 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.

要使 GLEW 与 MinGW 一起工作,您应该从 GLEW 网站下载源代码并放入

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

来自 MinGWin 的 gcc.exe
来自 MinGW32mingw32in 的 ar.exe

gcc.exe from MinGWin
ar.exe from MinGW32mingw32in

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

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

您将在 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 之前链接 SFML 库,最后链接 OpenGL.如果您更改链接顺序,您将收到链接器错误.

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.

不要忘记在创建窗口后调用glewInit().

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

这篇关于使用 mingw32 在窗户上发光的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Prevent class inheritance in C++(防止 C++ 中的类继承)
Why should I declare a virtual destructor for an abstract class in C++?(为什么要在 C++ 中为抽象类声明虚拟析构函数?)
Why is Default constructor called in virtual inheritance?(为什么在虚拟继承中调用默认构造函数?)
C++ cast to derived class(C++ 转换为派生类)
C++ virtual function return type(C++虚函数返回类型)
Is there any real risk to deriving from the C++ STL containers?(从 C++ STL 容器派生是否有任何真正的风险?)