错误:'defaultfloat'不是'std'的成员

时间:2014-04-27 05:17:16

标签: c++11 debian

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;

为什么我收到此错误?

1 个答案:

答案 0 :(得分:7)

GCC libstdc++在任何一个中都不支持这些C ++ 11操纵器 你编译的版本。一个月前提交了patch