天天看点

Box2d mingw环境搭建,编译前言:mingw的环境搭建:2,cmake 的配置(windows + mingw)3,premake 的配置

大家,可能用惯了图形化的IDE…不太熟悉这种命令行式的IDE工具..对于,c/c++编译,链接和调试就不太熟悉..所以..写了个简单教程…

<a href="http://sourceforge.net/projects/mingw/files/">http://sourceforge.net/projects/mingw/files/</a>

2.mingw有可能需要配置一些环境变量,最新版本应给直接帮你配置好环境变量了,如果没有可以参照下面 

配置环境变量: 

打开:“我的电脑-&gt;属性-&gt;高级-&gt;环境变量-&gt;系统变量”编辑如下系统变量: 

变量名 变量值 

PATH f:\MinGW\bin; 

LIBRARY_PATH f:\MinGW\lib 

C_INCLUDEDE_PATH f:\MinGW\include 

CPLUS_INCLUDE_PATH f:\MinGW\include

盘符…自己搞定吧…

因为我们一般用make

所以要把F:\MinGW\bin\mingw32-make.exe,复制并修改为make.exe

打上

gcc –v

<a target="_blank" href="http://blog.51cto.com/attachment/201202/212818244.png"></a>

看到这个就配置成功了….

<a href="http://www.cmake.org/cmake/resources/software.html">http://www.cmake.org/cmake/resources/software.html</a>

在安装好的cmake 目录下找到bin\cmake-gui.exe,双击打开

<a target="_blank" href="http://blog.51cto.com/attachment/201202/212825773.png"></a>

<a target="_blank" href="http://blog.51cto.com/attachment/201202/212833163.png"></a>

2,选择我们要编译到的地方

<a target="_blank" href="http://blog.51cto.com/attachment/201202/212853993.png"></a>

<a target="_blank" href="http://blog.51cto.com/attachment/201202/212901773.png"></a>

你就会看到

<a target="_blank" href="http://blog.51cto.com/attachment/201202/212908236.png"></a>

<a target="_blank" href="http://blog.51cto.com/attachment/201202/212915267.png"></a>

<a target="_blank" href="http://blog.51cto.com/attachment/201202/212922439.png"></a>

把图上要打的勾勾上

<a target="_blank" href="http://blog.51cto.com/attachment/201202/212930363.png"></a>

<a target="_blank" href="http://blog.51cto.com/attachment/201202/212938688.png"></a>

然后..开始我们漫长的编译过程

<a target="_blank" href="http://blog.51cto.com/attachment/201202/212945382.png"></a>

这里额外介绍一种,官方推荐的方式.

<a href="http://industriousone.com/premake/download">http://industriousone.com/premake/download</a>

注意!!一定要下载 premake4.4 的版本,因为,官方的文档有个参数是到premake4.4才支持…走了不少弯路呀…

然后运行

premake4 gmake

<a target="_blank" href="http://blog.51cto.com/attachment/201202/212952962.png"></a>

我们的make文件就建好了..

<a target="_blank" href="http://blog.51cto.com/attachment/201202/212959671.png"></a>

你会发现这里多了一个目录

make

<a target="_blank" href="http://blog.51cto.com/attachment/201202/213006190.png"></a>

又是漫长的编译过程…

不过..这个在我的电脑(winxp),在编译glui..的时候编译不过去(g++: /W1 找不到文件和目录,不过用cmake没这个问题..),有解决的同学希望告知!

本文转自 liam2199 博客,原文链接:http://blog.51cto.com/youxilua/772679   如需转载请自行联系原作者

继续阅读