建筑在窗户与mingw [英] Building glew on windows with mingw

查看:124
本文介绍了建筑在窗户与mingw的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我试过:



< blockquote>

gcc -static glew.c glewinfo.c visualinfo.c -I / path / to / glew / include


但我得到了成千上万的链接器错误(缺少引用)。



我不能用Make构建,因为不幸的是makefile有很多unix only命令,我没有cygwin或任何东西在工作。



(或者如果任何人可以指向我的窗口32b构建,我会非常感激)

解决方案

要使用MinGW构建它,你应该做(从make日志复制,略有修改和额外的解释):

  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

#创建库文件:lib / libglew32.dll.a
ar cr lib / libglew32.a src /glew.o

#创建pkg-config文件(如果你只想要一个lib,可选)
sed \
-es | @ prefix @ | / usr | g\
-es | @ libdir @ | / usr / lib | g\
-es | @ exec_prefix @ | / usr / bin | g\
-es | @ includedir @ | / usr / include / GL | g\
-es | @ version @ | 1.6.0 | g\
-e s | @ cflags @ || g\
-es | @ libname @ | GLEW | g\
< glew.pc.in> glew.pc

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

#创建库文件:lib / libglew32mx.dll.a
ar cr lib / libglew32mx.a src / glew.mx.o

#创建pkg-config文件(如果你只想要一个库,可选)
sed \
-es | @ prefix @ | / usr | g\
-e | @ libdir @ | / usr / lib | g\
-es | @ exec_prefix @ | / usr / bin | g\
-e | s | @ includedir @ | / usr / include / GL | g\
-es | @ version @ | 1.6.0 | g\
-es | @ cflags @ | -DGLEW_MX | g \\
-es | @ libname @ | GLEWmx | g\
< glew.pc.in> glewmx.pc

#制作glew visualinfo程序。跳过这个如果你只想lib
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

然后你应该有一个lib文件夹和一个bin文件夹与所需的可执行文件和库


Can anyone give me the correct command to build glew on windows with mingw?

I have tried:

gcc -static glew.c glewinfo.c visualinfo.c -I/path/to/glew/include

but I am getting thousands of linker errors (missing reference).

I can't build with Make because unfortunately the makefile has lots of unix only commands and i don't have cygwin or anything at work.

(alternatively if anyone can point me to a windows 32b build i would be very grateful)

解决方案

To build it with MinGW, you should do (copied from the make log, with slight modifications and additional explanations):

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

# Create library file: lib/libglew32.dll.a
ar cr lib/libglew32.a src/glew.o

# Create pkg-config file (optional if you just want a lib)
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

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

# Create library file: lib/libglew32mx.dll.a
ar cr lib/libglew32mx.a src/glew.mx.o

# Create pkg-config file (optional if you just want a lib)
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@|-DGLEW_MX|g" \
                -e "s|@libname@|GLEWmx|g" \
                < glew.pc.in > glewmx.pc

# Make the glew visualinfo program. Skip this if you want just the lib
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

You should then have a lib folder and a bin folder with the desired executables and libraries

这篇关于建筑在窗户与mingw的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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