How do I enable support for the new C++ standard on the Eclipse CDT indexer in Juno/Kepler/Luna?
Asked
Active
Viewed 2.7k times
37
-
1This is not a duplicate. The accepted (and correct) answer isn't in that other question. – Steve Aug 19 '14 at 16:34
-
@Steve: Johan Lundberg's answer contains the accepted one: https://stackoverflow.com/a/13549029/760746 – Nobody moving away from SE Aug 19 '14 at 16:51
1 Answers
88
Note that this question (and answer) only deals with the Eclipse indexer which is used to highlight errors before compilation takes place. The C++ compiler settings are not changed! (Thus, compilation could still fail because of missing C++11 settings, but have a look at the "Related" section)
To change the Eclipse indexer settings go to
Project properties
-> C/C++ General
-> Preprocessor Include Paths, Macros etc.
-> tab Providers
-> CDT GCC Built-in Compiler Settings
and append -std=c++0x
(or -std=c++11
) to Command to get compiler specs:
Afterwards it should look something like:
${COMMAND} -E -P -v -dD ${INPUTS} -std=c++0x
Sources
- http://wiki.eclipse.org/CDT/User/FAQ#CDT_does_not_recognize_C.2B.2B11_features
- http://www.eclipse.org/forums/index.php/mv/msg/373462/909018/#msg_909018
Related
- Eclipse CDT C++11/C++0x support
- https://stackoverflow.com/a/17499266/760746 (C++11-enable the compiler (Kepler and before))
- https://stackoverflow.com/a/22480299/760746 (C++11-enable the compiler (Kepler (updated) and newer)
Update
Successfully tested with Eclipse
- Kepler (CDT 8.2)
- Luna (CDT 8.4)

Community
- 1
- 1

Nobody moving away from SE
- 9,347
- 3
- 45
- 92
-
17Additionally, I had to restart Eclipse, before the changes took affect! – abergmeier Dec 30 '12 at 14:52
-
3In case anyone else can't get this to work, I also had to add this symbol to Eclipse for some reason: __GXX_EXPERIMENTAL_CXX0X__ – KyleL Dec 05 '13 at 20:05
-
5Under Kepler, after doing this, I still got the same errors, I needed to rebuild the index before the results were visible to the IDE: http://stackoverflow.com/questions/3008293/clean-eclipse-index-it-is-out-of-sync-with-code – mseddon Feb 07 '14 at 22:26
-
For Eclipse 4.4 Luna you also have to modify compiler settings: http://stackoverflow.com/a/24561615/1169741 – Trismegistos Jul 03 '14 at 19:22
-
@Trismegistos: Please not that this question is specifically about the indexer and not about the other parts that might be configured to use C++11. Thus, the answer remains the same. – Nobody moving away from SE Aug 19 '14 at 16:38
-
2Yay! worked nicely here after index-rebuild + eclipse-restart. I am using Kepler: Version: Kepler Service Release 2. Build id: 20140224-0627. – JohnTortugo Dec 10 '14 at 03:21