您的位置:首页 > 编程语言 > C语言/C++

Eclipse - "Eclipse CDT" (Eclipse C++) 安装 与 配置 (支持C++11)

2013-11-01 10:56 429 查看

"Eclipse CDT" (Eclipse C++) 安装 与 配置 (支持C++11)

 



 
禁止转载, 如有商业需求请站内联系.

本文地址: http://blog.csdn.net/caroline_wendy/article/details/13997159

因为VS2012对于C++11的支持不是特别好, 所以可以使用Eclipse CDT, 比较好的支持C++11;
根据本人的经验, 提供一个完整的配置解决方案:
1. Eclipse CDT (C/C++ Development Tooling): 下载地址: http://www.eclipse.org/downloads/
选择: Windows 32 Bit;



2. MinGW (Minimalist GNU for Windows) : 下载地址: http://sourceforge.net/projects/mingw/?source=dlp
下载, 默认安装即可, 并写入环境变量: "D:\MinGW\bin;D:\MinGW\msys\1.0\bin;"重启; 目前(2013.11.2)版本为GCC4.8.1;
cmd输入gcc --version进行验证;
3. Eclipse是压缩包形式, 解压即可使用; 需要配置的地方有:
(1). 目录: .\MinGW\bin 中, 把mingw32-make.exe复制为make.exe; 解决: "Program "make" not found in PATH" 问题,未必;
(2). IDE: Project -> Properties -> C/C++ Build -> Settings ->Binary Parsers: 选择: PE Windows Parser; 解决: "Launch failed. Binary not found."问题;
右键"Run as"即可出现, 原因: windows和linux的解析器(Parser)不同, windows需要选择"PE Windows Parser";
(3). IDE: Run -> Run Configurations -> Environment -> New:Name: Path; Value: D\MinGW\bin; (如果你安装在D盘); 解决: "Console无法显示输出" 问题;
(4). IDE: Project -> Properties -> C/C++ Build -> Settings -> Tool Settings ->Cross G++ Complier -> Miscellaneous -> Other flags:
添加: "-c -fmessage-length=0 -std=c++11"; GCC在make时, 添加C++11的特性.
解决: "This file requires compiler and library support for the ISO C++ 2011 standard." 问题, 支持C++11;



以上问题均为当前版本出现的问题, 截止: 2013-11-01.
4. 常用设置及命令:
(1) Windows -> Preferences -> C/C++ -> Editor->Content Assist: 修改: delay (ms) 为 "1", 则提示速度加快;
(2) "Run as " 快捷键 Ctrl+F11, 不是F11, F11是debug ; 自动补全快捷键: Alt+/ ;

测试:#include <iostream>
#include <array>
#include <vector>

int main(void) {
std::vector<int> iv = {1, 2, 3, 4, 5};
for(const auto& i : iv)
std::cout << i << " ";
std::cout << std::endl;
std::cout << "hello world! " << std::endl;
}


附: 如有其它问题, 可以参考http://blog.csdn.net/caroline_wendy/article/details/17039847 http://blog.csdn.net/caroline_wendy/article/details/14073511 http://blog.csdn.net/caroline_wendy/article/details/13997159
 

 
 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息