std::defaultfloat似乎没有在GCC中定义,尽管符合标准(我认为是§27.5.6.4).我把它分离到了这个简单的程序:
// test.cpp
#include <iostream>
int main()
{
std::cout << std::defaultfloat << 1.3;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
这在VC++ 11中编译.我尝试使用以下两个命令使用g ++ 4.7.2和g ++ 4.9.0编译它:
g ++ test.cpp g ++ test.cpp -std = c ++ 11
我也在这里尝试了GCC 4.8.1的在线编译,总是得到相同的结果:
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;
Run Code Online (Sandbox Code Playgroud)
为什么我收到此错误?
| 归档时间: |
|
| 查看次数: |
3100 次 |
| 最近记录: |