如何解决当使用__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 举报,一经查实,本站将立刻删除。