score:182

Accepted answer

there's two things you have to do, first you need to setup your compiler, then you need to setup cdt's language processor. since you didn't mention which compiler you're using, i'll assume it's gcc but the steps will be similar for other compilers. (note that you need a compiler that supports c++11, of course.)

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
  4. in the other flags box, append "-std=c++11" to the list of tokens.
  5. click apply and ok

at this point you should be able to rebuild your project and get it to run. but cdt still may show errors for c++11 includes. here's how you can resolve that:

  1. right click your project and click properties
  2. under c/c++ general click "preprocessor include paths, macros"
  3. select the providers tab
  4. there should be an item in the list that says something like "gcc built in compiler settings". select this entry.
  5. uncheck the "use global provider..." option
  6. under the list there's an box that says "command to get compiler specs." append "-std=c++0x" 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.
  8. click apply and then ok.
  9. back in your eclipse workspace, select the project menu, c/c++ index, and click "re-resolve unresolved includes."

score:0

the solution provided by mrericsir only works after having the latest eclipse oxygen cdt installed. it doesn't work for me with mars cdt.

score:1

i'm using eclipse luna and there is no "tool settings" under c/c++ build -> settings. i did add -std=c++11 to the compiler specs command line under "c/c++ general -> preprocessor includes -> providers" as suggested. but that still did not satisfy my indexer's ability to resolve emplace().

so i looked in the header file for and found that the emplace functions are dependent on __cplusplus >= 201103l. so i just added the preprocessor symbol "__cplusplus" and gave it the value 201103.

kinda hackish but the indexer is happy. (and makefiles define my build flags, not the eclipse project)

score:2

adding dialect flag "-std=c++11" to project properties-> c/c++ build -> settings -> tool settings (gcc c++ compiler -> dialect) solved my problem in eclipse kepler, apart from the settings stated above.

score:4

running eclipse indigo and cdt 8.0.2 here. i followed all the guides, but it was still necessary to set the preprocessor define by hand to find things like std::unique_ptr. the include file "memory" checks this. set __cplusplus to 201103l on the "symbols" tab under "paths and symbols" in "c++ general" in project properties.

score:6

i use eclipse kepler and to fix it i did this:

1 - right-click the project >> proprietes >> c/c++ build :: settings

2 - went to gcc g++ compiler >> miscellaneous >> other flags

i then added -std=c++11, hit apply and ok

that fixed my problem!

i hope this helps!

score:13

as of cdt 8.3 (available as a kepler update), there is a new dialect option in build settings:

http://wiki.eclipse.org/cdt/user/newin83#build

score:25

c++11 support in eclipse kepler service release 1 (build id: 20130919-0819)

in the latest release eclipse kepler sr1 you only have to add -std=c++11

  1. right click on your project and click properties
  2. navigate to c/c++ general and preprocessor include paths, macros etc.
  3. select the providers tab
  4. add -std=c++11 to command to get compiler specs:
  5. apply changes, the index should be generated automatically.

the "command to get compiler specs:"-line should look like:

${command} -e -p -v -dd "${inputs}" -std=c++11

Related Query

More Query from same tag