繁体   English   中英

如何使用LLVM 4.1忽略Xcode中的行外定义错误

[英]How to ignore Out-of-line definition error in Xcode with LLVM 4.1

我收到LLVM 4.1的编译器错误:

/Users/vibhor/src/mam/client_daemon/source/core/_osx/UtilSystem_OSX.cpp:261:32: Out-of-line definition of 'what' does not match any declaration in 'std::bad_typeid'

对于以下代码:

const char* ::std::bad_typeid::what() const throw() { return NULL; }

有没有办法抑制这种情况? 它可以与GCC一起编译。

我最初的答案是尝试使用其他stdlib进行编译完全是不合时宜的。

似乎是尝试针对10.5 SDK进行编译,该SDK的bad_typeid与预期的有所不同。 解决方法是防范定义:

#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
const char* ::std::bad_typeid::what() const throw() { return NULL; }
#endif

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM