8/31/2015

Setup Eclipse for C++ 11


Eclipse version

Setting up the compiler is fairly straightforward: 
1. Right click your project and click Properties
2. Under C/C++ Build click Settings
3. Under GCC C++ Compiler, click Miscellaneous. In the Other Flags box, append "-std=c++11" to the list of tokens.


C++11 includes and C++ indexing: 
1. Right click your project and click Properties
2. Under C/C++ General click "Preprocessor Include Paths, Macros"
3. Select the Providers tab
4. Select "CDT GCC Built-in Compiler Settings"
5. Uncheck the "Use global provider shared between projects" option
6. Under the list there's an box that says "Command to get compiler specs." Append "-std=c++11"   to this.


7. Move the "GCC Built in Compiler Settings" provider at the top of the list using the 'Move Up' button on the right. Click Apply and then OK
8. Go to Properties" C/C++ General -> Paths and Symbols -> Symbols -> GNU C++
9. Add __GXX_EXPERIMENTAL_CXX0X__ into "Name" and leave "Value" blank

10. Back in your Eclipse workspace, you project will start indexing. If not, select the Project Menu, C/C++ Index, and click "Re-resolve unresolved includes."


Note:

Setting up **__GXX_EXPERIMENTAL_CXX0X__** does not help 
To fix C++11 syntax highlighting go to:
Project Properties --> C/C++ General --> Paths and Symbols --> Symbols --> GNU C++
and overwrite the symbol (i.e. add new symbol):

__cplusplus
with value
201103L
Besides, you can try to enable indexer to scan all files: Window -> Preferences -> C/C++ -> Indexer

1 comment: