xcode 命名空间“std”中没有名为“shared_ptr”的类型
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12819886/
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
no type named 'shared_ptr' in namespace 'std'
提问by bnduati
Hopefully this helps somebody else
希望这对其他人有帮助
Trying to compile an iOS project with Cedar BDD kept failing with no type named 'shared_ptr' in namespace 'std' error message. It was obviously a C++ error but couldn't understand why the C++ library Xcode was using didn;t have the shared_ptr type defined until I discovered the build settings of the target provides two libraries to choose from
尝试使用 Cedar BDD 编译 iOS 项目一直失败,命名空间“std”错误消息中没有名为“shared_ptr”的类型。这显然是一个 C++ 错误,但无法理解为什么 Xcode 使用的 C++ 库没有定义;直到我发现目标的构建设置提供了两个库可供选择之前,才定义了 shared_ptr 类型
- libstdc++ (compiler default)
- libc++
- libstdc++(编译器默认)
- 库++
回答by bnduati
selecting libc++ fixes the problem see screenshot
选择 libc++ 修复了问题,看截图
回答by Jonathan Wakely
Apple ship a veryold version of libstdc++ that doesn't support C++11, so if you use libstdc++ you can't use C++11 features.
Apple 发布了一个非常旧的 libstdc++ 版本,它不支持 C++11,所以如果你使用 libstdc++,你就不能使用 C++11 的特性。
回答by jeff
In xcode you must use #include <memory>
, you can not use #include <memory.h>
. Please check this.
在 xcode 中你必须使用#include <memory>
,你不能使用#include <memory.h>
. 请检查这个。