1、New->C++ Project->Excutable->linux gcc  ->Hellowworld ... 新建项目
在property->C++ General->path...-> include处添加include引用 ,在libraries处添加 库名
 
2、对C++11 的支持问题
 

因为VS2012对于C++11的支持不是特别好, 所以可以使用Eclipse CDT, 比较好的支持C++11;

  根据本人的经验, 提供一个完整的配置解决方案:

1. Eclipse CDT (C/C++ Development Tooling): 下载地址:

  选择: Windows 32 Bit;

730x80

2. MinGW (Minimalist GNU for Windows) : 下载地址:

  下载, 默认安装即可, 目前(2013.11.2)版本为GCC4.6.2;

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 -$amp;>amp;$nbsp;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;

550x100

  以上问题均为当前版本出现的问题, 截止: 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 $amp;

 
 
 
  1. Project settings

    project右键-> c/c++ build ->Settings -> GCC C++ Compiler -> Miscellaneous -> Other flags后面加上 -std=c++11

  2. Workspace settings

    Window-> Preference -> Build -> Settings ->Discovery -> CDT GCC Built-in Compiler Settings MinGW(shared) ->(command to get compiler specs) ${COMMAND} -E -P -v -dD "${INPUTS}" -std=c++11

     

     

    使用eclipse编译含有C++11特性的代码,总是出错。最后在stackoverflow找到了解决方法。
    1. 右击项目,选择Properties。
    2. C/C++ Build --> Settings --> Tool Settings --> GCC C++ Compiler --> Miscellanous。在右边的Other Flags中把 "-std=c++0x" 引号中的内容放到已有内容的后面。
    -std=c++0x
     
    2.C/C++ General -> Paths and Symbols -> Symbols -> GNU C++。点击Add,name栏复制__GXX_EXPERIMENTAL_CXX0X__,value为空。
    __GXX_EXPERIMENTAL_CXX0X__
     
    3. OK。

     

     

    • Make a new C++ project
    • Default options for everything
    • Once created, right-click the project and go to "Properties"
    • C/C++ Build -> Settings -> Tool Settings -> GCC C++ Compiler -> Miscellaneous -> Other Flags. Put -std=c++0x (or for newer compiler version -std=c++11 at the end . ... instead of GCC C++ Compiler I have also Cygwin compiler
    • C/C++ General -> Paths and Symbols -> Symbols -> GNU C++. Click "Add..." and paste __GXX_EXPERIMENTAL_CXX0X__ (ensure to append and prepend two underscores) into "Name" and leave "Value" blank.
    • Hit Apply, do whatever it asks you to do, then hit OK.
 
posted on 2015-09-10 10:15  自由恶魔  阅读(213)  评论(0)    收藏  举报