大家,可能用慣了圖形化的IDE…不太熟悉這種指令行式的IDE工具..對于,c/c++編譯,連結和調試就不太熟悉..是以..寫了個簡單教程…
<a href="http://sourceforge.net/projects/mingw/files/">http://sourceforge.net/projects/mingw/files/</a>
2.mingw有可能需要配置一些環境變量,最新版本應給直接幫你配置好環境變量了,如果沒有可以參照下面
配置環境變量:
打開:“我的電腦->屬性->進階->環境變量->系統變量”編輯如下系統變量:
變量名 變量值
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 如需轉載請自行聯系原作者