no type named 'shared_ptr' in namespace 'std'

北城余情 提交于 2019-12-01 05:22:21

问题


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

  • libstdc++ (compiler default)
  • libc++

回答1:


selecting libc++ fixes the problem see screenshot




回答2:


Apple ship a very old version of libstdc++ that doesn't support C++11, so if you use libstdc++ you can't use C++11 features.




回答3:


In xcode you must use #include <memory>, you can not use #include <memory.h>. Please check this.



来源:https://stackoverflow.com/questions/12819886/no-type-named-shared-ptr-in-namespace-std

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!