[心得] Codeblocks Setup with GCC 4.5.0
最近幫我的 codeblocks 換了 GCC 4.5.0 (原本是 3.4.5)
跟大家分享一下安裝過程
以下是 blog 圖文版
http://spider391cplusplus.blogspot.com/2010/08/codeblocks-setup-with-gcc-450.html
以下是文字的敘述注意事項
執行平台為 Win XP 32-bit
1.重點是安裝 TDM's GCC 4.5.0
http://sourceforge.net/projects/tdm-gcc/
設定目錄時,盡量不要用預設目錄 C:\mingw32
可以設定個自己的程式執行環境資料夾
我是設在 d:\dev\mingw32
2.安裝 codeblock
http://www.codeblocks.org/
下載時,選擇 codeblocks-10.05-setup.exe 不要選擇含有 mingw
(這個gcc 版本比較舊)
目錄說明同上
3. compile 時要使用 C++0x 要在 Setting -> Compiler and Debugger
中勾選 -std=c++0x 的編譯選項
附上測試的 code
======================================================
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
vector<string> v;
v.push_back("Be");
v.push_back("whatever");
v.push_back("you");
v.push_back("want");
v.push_back("to");
v.push_back("be.");
sort(v.begin(),v.end(),[](const string& lhs,const string& rhs){
return lhs.size() < rhs.size();
}
);
return 0;
}
========================================================
4. Scott Meyers 這篇 blog 介紹了 GCC 4.5 的更新特色,可以參考
(就是大名鼎鼎的 Effective C++ 的作者啦)
http://scottmeyers.blogspot.com/2010/07/updated-c0x-feature-availability.html
5. 順道一提,我看 codeblocks GCC compiler 有個選項是
"Enable Effective-C++ warning(thanks Scott Meyers) [-Weffc++]"
我第一次看到這個選項(有人用過嗎)
可以分享一下心得 XDXD
-----------------------
Enjoy It ~ \( ̄︶ ̄)>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.216.170.70
推
08/06 11:40, , 1F
08/06 11:40, 1F
推
08/06 11:43, , 2F
08/06 11:43, 2F
推
08/06 12:41, , 3F
08/06 12:41, 3F
→
08/06 12:44, , 4F
08/06 12:44, 4F
推
08/06 12:49, , 5F
08/06 12:49, 5F
推
08/06 13:26, , 6F
08/06 13:26, 6F
→
08/06 13:40, , 7F
08/06 13:40, 7F
→
08/06 13:42, , 8F
08/06 13:42, 8F
→
08/06 13:43, , 9F
08/06 13:43, 9F
→
08/06 13:44, , 10F
08/06 13:44, 10F
推
08/06 16:47, , 11F
08/06 16:47, 11F
推
08/06 19:11, , 12F
08/06 19:11, 12F