在 Eclipse CDT (Juno/Kepler/Luna) 索引器中启用 C++11

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13635079/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 17:33:58  来源:igfitidea点击:

Enable C++11 in Eclipse CDT (Juno/Kepler/Luna) indexer

c++c++11eclipse-cdt

提问by Nobody

How do I enable support for the new C++ standard on the Eclipse CDT indexer in Juno/Kepler/Luna?

如何在 Juno/Kepler/Luna 中的 Eclipse CDT 索引器上启用对新 C++ 标准的支持?

回答by Nobody

Notethat this question (and answer) only deals with the Eclipse indexerwhich 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)

请注意,此问题(和答案)仅涉及用于在编译之前突出显示错误的Eclipse 索引器C++ 编译器设置没有改变!(因此,由于缺少 C++11 设置,编译仍然可能失败,但请查看“相关”部分)

To change the Eclipse indexersettings go to Project properties-> C/C++ General-> Preprocessor Include Paths, Macros etc.-> tab Providers-> CDT GCC Built-in Compiler Settings

要更改Eclipse 索引器设置,请转到 Project properties-> C/C++ General-> Preprocessor Include Paths, Macros etc.-> 选项卡Providers->CDT GCC Built-in Compiler Settings

and append -std=c++0x(or -std=c++11) to Command to get compiler specs:

并将-std=c++0x(或-std=c++11)附加到Command to get compiler specs:

Afterwards it should look something like:

之后它应该看起来像:

${COMMAND} -E -P -v -dD ${INPUTS} -std=c++0x

${COMMAND} -E -P -v -dD ${INPUTS} -std=c++0x

Screenshot of the configuration pane with the change applied

应用了更改的配置窗格的屏幕截图

Sources

来源

Related

有关的

Update

更新

Successfully tested with Eclipse

使用 Eclipse 成功测试

  • Kepler (CDT 8.2)
  • Luna (CDT 8.4)
  • 开普勒 (CDT 8.2)
  • 露娜 (CDT 8.4)