| Guide to Eclipse with C++11 standard [message #787571] |
Tue, 31 January 2012 13:37  |
Robert Pavel Messages: 3 Registered: August 2010 |
Junior Member |
|
|
Figured it would be worth making a thread for people who, like me, are trying to get the Eclipse support for the C++11 (previously known as C++0x) standard. Currently the info is spread out over a few threads, but I didn't find an easy centralized location. As with most computer-related help forums on the internet, people don't come back once they have a solution.
After a bit of research and fiddling, the following steps seem to work (if someone more knowledgeable wants to correct me, feel free).
This is for Eclipse Indigo with CDT 8.0.1.
Standard Project
- Make a new C++ project (currently I have only tested "Empty Project -> Linux GCC". Others can verify on non-Linux platforms)
- 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" at the end
- C/C++ General -> Paths and Symbols -> Symbols -> GNU C++. Click "Add..." and paste "__GXX_EXPERIMENTAL_CXX0X__" into "Name" and leave "Value" blank.
- Hit Apply, do whatever it asks you to do, then hit OK.
Makefile Project
- Make a new empty Makefile project (or import an old one)
- Default options for everything
- Once created, right-click the project and go to "Properties"
- C/C++ General -> Paths and Symbols -> Symbols -> GNU C++. Click "Add..." and paste "__GXX_EXPERIMENTAL_CXX0X__" into "Name" and leave "Value" blank.
- Hit Apply, do whatever it asks you to do, then hit OK.
- Obviously make sure your rule includes "-std=c++0x" as a compiler option.
And everything should be functional (based on limited testing). At the very least,
I got a few examples to compile, which is enough for me to start development. Syntax highlighting works, and so does building.
[Updated on: Tue, 31 January 2012 14:20] Report message to a moderator
|
|
|
|
| Re: Guide to Eclipse with C++11 standard [message #792006 is a reply to message #787571] |
Mon, 06 February 2012 08:59   |
Axel Mueller Messages: 1830 Registered: July 2009 |
Senior Member |
|
|
Quote:C/C++ General -> Paths and Symbols -> Symbols -> GNU C++. Click "Add..." and paste "__GXX_EXPERIMENTAL_CXX0X__" into "Name" and leave "Value" blank.
Instead of this you should add the option -std=c++0x to the scanner discovery in Project Properties->C/C++ Build ->Discovery Options in the field "compiler invocation arguments". This way Eclipse (or better said the compiler) will find automatically the correct includes and __GXX_EXPERIMENTAL_CXX0X__ is automatically defined.
BTW, could you please add your instructions to the CDT FAQ http://wiki.eclipse.org/CDT/User/FAQ
Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
|
|
|
|
| Re: Guide to Eclipse with C++11 standard [message #792796 is a reply to message #792013] |
Tue, 07 February 2012 07:23  |
Axel Mueller Messages: 1830 Registered: July 2009 |
Senior Member |
|
|
Oodini Mising name wrote on Mon, 06 February 2012 15:06As my project is described with a CMake file, I have to declare it as C++11 each time the project is updated (because I then reimport the project as a makefile project).
Woudl it be possible to set that once ?
In Windows->Preferences->C/C++->New CDT project wizard->Makefile project you can set options for the discovery
Enable "Automate discovery" use "GCC per project scanner" as Discovery profile.
I never used this option so I would be happy about your feedback.
Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
|
|
|
Powered by
FUDForum. Page generated in 0.01941 seconds