【发布时间】:2016-07-20 13:54:05
【问题描述】:
我正在尝试安装 C 库:ssht
我已经设置了 makefile,它肯定会找到依赖项。然而,当我使用 gcc 制作它时,我收到了一些警告:
In file included from ../ssht/src/c/ssht_core.c:23:0:
../ssht/src/c/ssht_core.c: At top level:
../ssht/src/c/ssht_sampling.h:39:20: warning: inline function ‘ssht_sampling_ind2elm’ declared but never defined
extern inline void ssht_sampling_ind2elm(int *el, int *m, int ind);
然后当我对代码进行测试时,我得到了错误:
"_ssht_sampling_elm2ind", referenced from:
_ssht_test_gen_flm_complex.constprop.1 in ssht_test.o
_ssht_test_gen_flm_real in ssht_test.o
_ssht_test_gen_lb_flm_real in ssht_test.o
_ssht_test_gen_flm_complex in ssht_test.o
_ssht_test_gen_lb_flm_complex in ssht_test.o
_main in ssht_test.o
_ssht_core_mwdirect_inverse in libssht.a(ssht_core.o)
...
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make: *** [../ssht/bin/c/ssht_test] Error 1
我找不到任何我能理解的解决方案。顺便说一下,我的 gcc 版本是:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin14.4.0/5.1.0/lto-wrapper
Target: x86_64-apple-darwin14.4.0
Configured with: ../gcc-5.1.0/configure --enable-languages=c++,fortran
Thread model: posix
gcc version 5.1.0 (GCC)
我尝试使用 -m32 安装为 32 位安装,看看是否改变了情况,但使用 i386 而不是 x86_64 时出现相同的错误。
我已经将它安装在一台 Linux 机器上,我也可以使用一个相同的 makefile 访问它,除了其中一个依赖项的位置。
请帮忙!
【问题讨论】:
-
ssht_sampling_ind2elm看起来怎么样? -
@ead 函数就是这样: inline void ssht_sampling_elm2ind(int *ind, int el, int m) { *ind = el * el + el + m; }
-
也许你应该用 GNU89 构建(我猜现在它正在构建 C99)。见stackoverflow.com/questions/216510/extern-inline/216546#216546
标签: c gcc makefile architecture x86-64