gpt4 book ai didi

c++ - 如何在 Eclipse CDT 中启用 C++11/C++0x 支持?

转载 作者:太空宇宙 更新时间:2023-11-04 13:42:43 24 4
gpt4 key购买 nike

eclipse 3.7.1CDT 1.4.1海湾合作委员会 4.6.2

这是一段 C++11 代码的示例:

auto text = std::unique_ptr<char[]>(new char[len]);

Eclipse 编辑器提示:

Function 'unique_ptr' could not be resolved

Makefile 编译工作正常。如何让 Eclipse 停止提示这类错误?

最佳答案

我找到了 this Eclipse 论坛中的文章,只需按照这些步骤操作,它对我有用。我在带有 Cygwin 设置的 Windows 上使用 Eclipse Indigo 20110615-0604。

  • 创建一个新的 C++ 项目
  • 一切的默认选项
  • 创建后,右键单击项目并转到“属性”
  • C/C++ 构建 -> 设置 -> 工具设置 -> GCC C++ 编译器 -> 杂项 -> 其他标志。将 -std=c++0x (或较新的编译器版本 -std=c++11 放在末尾......而不是 GCC C++ 编译器我也有Cygwin 编译器
  • C/C++ 通用 -> 路径和符号 -> 符号 -> GNU C++。单击“添加...”并将 __GXX_EXPERIMENTAL_CXX0X__(确保附加两个下划线)粘贴到“名称”中并将“值”留空。
  • 点击“应用”,执行它要求您做的任何事情,然后点击“确定”。

现在 Eclipse 常见问题解答中也有对此的描述:Eclipse FAQ/C++11 Features .

eclipse 设置

Eclipse image setting

关于c++ - 如何在 Eclipse CDT 中启用 C++11/C++0x 支持?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27195427/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com