Quadruple precision in G++ 4.6.3 Linux using quadmath

懵懂的女人 提交于 2019-12-01 04:58:45

I see the same behaviour:

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

One workaround is to include the header using this pattern instead:

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

after which:

~/coding/q$ g++ test.cpp -lquadmath
~/coding/q$ ./a.out 
1.000000
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!