- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我试图用 gcc 4.8 和 clang 获取 __STDC_VERSION__
,但它只是没有定义。编译器标志:
g++ -std=c++11 -O0 -Wall -Wextra -pedantic -pthread main.cpp && ./a.out
http://coliru.stacked-crooked.com/a/b650c0f2cb87f26d
#include <iostream>
#include <string>
int main()
{
std::cout << __STDC_VERSION__ << std::endl;
}
结果:
main.cpp:6:18: 错误:“__STDC_VERSION__”未在此范围内声明
我必须包含一些 header ,或添加编译器标志?
最佳答案
__STDC_VERSION__
...
This macro is not defined if the -traditional-cpp option is used, nor when compiling C++ or Objective-C.
此外,C++ 标准将定义这个宏与否的实现留给了实现,而 g++ 选择了后者。
根据您尝试执行的操作,__cplusplus
宏可能是一个替代方案(它不仅被定义,它也有一个值;)
关于c++ - __STDC_VERSION__ 未在 C++11 中定义?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24477228/
关闭。这个问题是not reproducible or was caused by typos .它目前不接受答案。 这个问题是由于错别字或无法再重现的问题引起的。虽然类似的问题可能是on-topi
这个问题在这里已经有了答案: Adding zero in c preprocessor statement (1 个回答) 关闭 7 年前。 通过查看 stdarg.h,我发现了以下内容: #if
我知道编译器使用 __STDC__ 来指示编译器是标准 C,从那里,您可以使用 __STDC_VERSION__ 来确定哪个级别 您正在使用的标准。 我也知道 C90 没有值,C90 修正案 1 有
我试图用 gcc 4.8 和 clang 获取 __STDC_VERSION__,但它只是没有定义。编译器标志: g++ -std=c++11 -O0 -Wall -Wextra -pedantic
我知道对于 C11,我可以测试 #if(__STDC_VERSION >= 20112L)。但对于 -std=c1x 我应该测试什么宏和/或值? 该标准的术语是什么?或者可能是非正式名称(如果有)。我
我是一名优秀的程序员,十分优秀!