加入收藏 | 设为首页 | 会员中心 | 我要投稿 源码门户网 (https://www.92codes.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

使用quadmath的G 4.6.3 Linux中的四倍精度

发布时间:2021-01-12 15:32:32 所属栏目:Linux 来源:网络整理
导读:我尝试执行代码 #include 用命令 g++ test.cpp -o test 我收到错误: /tmp/cctqto7E.o: In function `main':test.cpp:(.text+0x51): undefined reference to `quadmath_snprintf(char*,unsigned int,char const*,...)'collect2: ld returned 1 exit status

我尝试执行代码

#include 

用命令

g++ test.cpp -o test

我收到错误:

/tmp/cctqto7E.o: In function `main':
test.cpp:(.text+0x51): undefined reference to `quadmath_snprintf(char*,unsigned int,char const*,...)'
collect2: ld returned 1 exit status

版本是:

g++ --version
g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation,Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

我该如何解决这个问题? 最佳答案 我看到了同样的行为:

~/coding/q$g++ test.cpp -lquadmath
/tmp/ccYdHwL5.o: In function `main':
test.cpp:(.text+0x51): undefined reference to `quadmath_snprintf(char*,...)'
collect2: ld returned 1 exit status

一种解决方法是使用此模式包含标头:

extern "C" {
#include "quadmath.h"
}

之后:

~/coding/q$g++ test.cpp -lquadmath
~/coding/q$./a.out 
1.000000

(编辑:源码门户网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读