std::defaultfloat
似乎没有在GCC中定义,尽管是in the standard(我认为它是§27.5.6.4)。我把它分离到了这个简单的程序:
// test.cpp
#include <iostream>
int main()
{
std::cout << std::defaultfloat << 1.3;
return 0;
}
这在VC ++ 11中编译。我尝试使用这两个命令用g ++ 4.7.2和g ++ 4.9.0编译它:
g ++ test.cpp g ++ test.cpp -std = c ++ 11
我也试过了an online compile on GCC 4.8.1 here,总是得到相同的结果:
user@office-debian:~/Documents/test$ g++ test.cpp -std=c++11
test.cpp: In function ‘int main()’:
test.cpp:5:15: error: ‘defaultfloat’ is not a member of ‘std’
std::cout << std::defaultfloat << 1.3;
为什么我收到此错误?