gpt4 book ai didi

c++ - GSL 编译错误

转载 作者:行者123 更新时间:2023-11-28 06:39:41 25 4
gpt4 key购买 nike

我已经在 Kubuntu 14.04 中安装了最新版本的 GSL (1.16)。我使用库附带的文件 INSTALL(逐步)进行安装。我配置了 eclipse-cdt 环境以供使用。它工作,我认为,因为有一个自动完成,但是当我开始编译程序时出现一些错误。请问,我该如何解决?

对不起我的英语不好!!!文件 math.c 有#include

Building target: C
Invoking: GCC C Linker
gcc -L/usr/local/lib -o "C" ./src/C.o -lgsl -lgslcblas
/usr/local/lib/libgsl.a(math.o): In function `gsl_complex_polar':
/home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:56: undefined reference to `sincos'
/usr/local/lib/libgsl.a(math.o): In function `gsl_complex_logabs':
/home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:115: undefined reference to `log'
/home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:115: undefined reference to `log1p'
/usr/local/lib/libgsl.a(math.o): In function `gsl_complex_abs':
/home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:83: undefined reference to `hypot'
/home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:83: undefined reference to `hypot'
/usr/local/lib/libgsl.a(math.o): In function `gsl_complex_sqrt':
/home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:293: undefined reference to `sqrt'
/home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:293: undefined reference to `sqrt'
/home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:288: undefined reference to `sqrt'
/home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:288: undefined reference to `sqrt'
/home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:293: undefined reference to `sqrt'
......
collect2: error: ld returned 1 exit status
make: *** [C] Error 1

最佳答案

这很可能只是缺少指向数学库的链接。您可能想尝试将 -lm 添加到您的链接命令中,在 -lgsl -lgslcblas 之后。

关于c++ - GSL 编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26186501/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com