Eclipse CDT C ++ 11 / C ++ 0x支持 [英] Eclipse CDT C++11/C++0x support
问题描述
Eclipse 3.7.1
CDT 1.4.1
GCC 4.6.2
Eclipse 3.7.1 CDT 1.4.1 GCC 4.6.2
这是一个C ++ 11的一个例子代码:
This is an example of a piece of C++11 code:
auto text = std::unique_ptr<char[]>(new char[len]);
Eclipse编辑器抱怨:
The Eclipse editor complains about:
Function 'unique_ptr' could not be resolved
Makefile编译工作精细。如何让Eclipse停止抱怨这些错误?
The Makefile compilation works fine. How to make Eclipse stop complaining about these sort of errors?
推荐答案
我发现这篇文章在Eclipse论坛上,只是按照这些步骤,它适用于我。我在Windows上使用Eclipse Indigo 20110615-0604,配有Cygwin设置。
I found this article in the Eclipse forum, just followed those steps and it works for me. I am using Eclipse Indigo 20110615-0604 on Windows with a Cygwin setup.
- 创建一个新的C ++项目
-
- 创建后,右键单击该项目并转到属性
- C / C ++ Build - >设置 - >工具设置 - > GCC C ++编译器 - >其他 - >其他标志。将
-std = c ++ 0x
(或更新的编译器版本-std = c ++ 11
...而不是GCC C ++编译器我也有Cygwin编译器 - C / C ++常规 - >路径和符号 - >符号 - > GNU C ++。单击添加...和粘贴
__ GXX_EXPERIMENTAL_CXX0X __
(确保附加并添加两个下划线)到名称中,并将值留空。 - 点击申请无论它要求你做什么,然后点击OK。
- Make a new C++ project
- Default options for everything
- Once created, right-click the project and go to "Properties"
- C/C++ Build -> Settings -> Tool Settings -> GCC C++ Compiler -> Miscellaneous -> Other Flags. Put
-std=c++0x
(or for newer compiler version-std=c++11
at the end . ... instead of GCC C++ Compiler I have also Cygwin compiler - C/C++ General -> Paths and Symbols -> Symbols -> GNU C++. Click "Add..." and paste
__GXX_EXPERIMENTAL_CXX0X__
(ensure to append and prepend two underscores) into "Name" and leave "Value" blank. - Hit Apply, do whatever it asks you to do, then hit OK.
现在有一个关于Eclipse FAQ的描述: Eclipse FAQ / C ++ 11功能。
There is a description of this in the Eclipse FAQ now as well: Eclipse FAQ/C++11 Features.
这篇关于Eclipse CDT C ++ 11 / C ++ 0x支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!