How to enable C++11/C++0x support in Eclipse CDT?

后端 未结 17 1891
说谎
说谎 2020-11-22 00:13

Eclipse 3.7.1 CDT 1.4.1 GCC 4.6.2

This is an example of a piece of C++11 code:

auto text = std::unique_ptr(new char[len]);
17条回答
  •  我寻月下人不归
    2020-11-22 00:41

    I found this article in the Eclipse forum, just followed those steps and it works for me. I am using Eclipse Indigo 20110615-0604 on Windows with a Cygwin setup.

    • 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.

    There is a description of this in the Eclipse FAQ now as well: Eclipse FAQ/C++11 Features.

    Eclipse image setting

提交回复
热议问题