当使用__float128时,cout导致编译错误错误:“ operator <<”的模棱两可的重载

问题描述

我在使用cout和__float128时遇到问题。

代码是:

__float128 su1 = 0.33333333333333333q;         
cout << "1 / 3 = " << su1 << endl;

而来自g ++(GCC)9.3.0的错误是:

g++ -std=gnu++17 -Wall -g -c -o third.o third.cc
third.cc: In function ‘int main()’:
third.cc:41:55: error: ambiguous overload for ‘operator<<’ (operand types are ‘std::basic_ostream<char>’ and ‘__float128’)
   41 |     cout << "1 / 3 = " << su1 << endl;
      |     ~~~~~~~~~~~~~~~~~~ ^~ ~~~~~
      |           |            |
      |           |             __float128
      |           std::basic_ostream<char>
In file included from /lib/gcc/x86_64-pc-cygwin/9.3.0/include/c++/iostream:39,from third.cc:9:

对错误有任何想法吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...