Xcode 4.5中“C标准库”和“C语言方言”的“编译器默认值”有什么价值?
我的猜测是libstdc和GNU 98,但澄清一下会很好.
Projects created using this Xcode release use the new libc++
implementation of the standard C++ library. The libc++ library is
available only on iOS 5.0 and later and OS X 10.7 and later. 12221787To enable deployment on earlier releases of iOS and OS X in your
project, set the C++ Standard Library build setting to libstdc++ (Gnu
C++ standard library).
我注意到创建一个新项目显式设置GNU 11和libc,但“编译器默认”可能是其他东西.
解决方法:
以下是了解最佳方法:
#include <iostream>
int main()
{
#ifdef _LIBCPP_VERSION
std::cout << "Using libc++\n";
#else
std::cout << "Using libstdc++\n";
#endif
#ifdef __GXX_EXPERIMENTAL_CXX0X__
#if __cplusplus == 1
std::cout << "Language mode = gnu++11\n";
#else
std::cout << "Language mode = c++11\n";
#endif
#else
#if __cplusplus == 1
std::cout << "Language mode = gnu++98\n";
#else
std::cout << "Language mode = c++98\n";
#endif
#endif
}
只需使用编译器默认值构建一个测试项目并运行它.
原文地址:https://codeday.me/bug/20190725/1537111.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。