您的位置:首页 > 编程语言 > C语言/C++

eclipse支持c++11

2014-12-23 22:00 711 查看


http://wiki.eclipse.org/CDT/User/FAQ#CDT_does_not_recognize_C.2B.2B11_features


CDT does not recognize C++11 features

GCC needs the compiler option "-std=c++0x" or "-std=gnu++0x" depending on your needs.

(please note: check the GCC manual also, because different GCC version may support different switches. For example GCC 4.7 accepts -std=c++11 also.)

Standard Project with managed make:

Open Project Properties->C/C++ Build->Settings->Tool Settings->GCC C++ Compiler->Miscellaneous->Other Flags. Put "-std=c++0x" at the end.

Since CDT 8.3 there is a new "Dialect" option in the compiler option settings, see: https://wiki.eclipse.org/CDT/User/NewIn83#Toolchains

Makefile project:

You must add the compiler option "-std=c++0x" to your Makefile.

To make the code completion and code analysis work:

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" (note the warning at the bottom of the page).

You then need to make the indexer update:

Open Project Properties->C/C++ General->Index->Index source and header files opened in the editor.  If you are not using project specific settings you need to follow the link to "Configure workspace settings".  This needs to be checked.  Give it a minute to
reindex.

Since Eclipse Juno a new Scanner Discovery is integrated in CDT version 8.1. This new scanner has a "hidden" option to set the C++11 feature, see this message:

http://www.eclipse.org/forums/index.php/mv/msg/373462/909018/#msg_909018
> Project Properties->C/C++ General->Preprocessor Include Paths,
> Macros->[Providers] tab->your Built-in Compiler Settings provider
> (toolchain dependent).
> Click on "Workspace Settings" link which gets you to "Settings" property
> page, select [Discovery] tab and your provider again. There is "Command
> to get compiler specs", add "-std=c++0x" in there.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  eclipse c++11