【发布时间】:2017-08-15 02:31:38
【问题描述】:
我正在编写一个 cpp 代码以将一个应用程序从 Windows 移植到 Mac。在 Xcode 中构建应用程序时,它会抛出错误:
"Use of undeclared identifier 'nothrow'; did you mean 'throw'? memory"
这些错误在 cpp 标准库头文件中抛出。
以下是错误堆栈说明:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1/memory:83:8: Use of undeclared identifier 'nothrow'; did you mean 'throw'?
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1/string:48:10: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1/string:48:
我在互联网上进行了搜索,但无法找到解决此问题的方法。任何建议都会有所帮助。为什么系统头文件会报错?
系统详情:
SDK 是 OSX 10.10。
-
用于编译应用程序的编译器选项是 C++ 标准库:
libc++(支持 C++11 的 LLVM C++ 标准。C++ 语言方言:GNU++11。C++ 编译器:Apple LLVM 6.0
【问题讨论】:
-
我最好的猜测是你需要指定你正在使用的 C++ 标准
-
C++11 支持是我使用的标准
-
感谢 Praveen Kumar。
-
为了确保你真的在使用 C++11 检查(并显示)你的编译器 CLI 选项
-
你好 zaufi。编译器使用的是 C++11。
标签: c++ xcode memory libstdc++ nothrow