Mar*_*arc 5 linker blas lapack armadillo
当我尝试编译Armadillo 2.4.2附带的example1.cpp时,我不断收到以下链接错误:
/tmp/ccbnLbA0.o: In function `double arma::blas::dot<double>(unsigned int, double const*, double const*)':
main.cpp:(.text._ZN4arma4blas3dotIdEET_jPKS2_S4_[double arma::blas::dot<double>(unsigned int, double const*, double const*)]+0x3b): undefined reference to `wrapper_ddot_'
/tmp/ccbnLbA0.o: In function `void arma::blas::gemv<double>(char const*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, int const*)':
main.cpp:(.text._ZN4arma4blas4gemvIdEEvPKcPKiS5_PKT_S8_S5_S8_S5_S8_PS6_S5_[void arma::blas::gemv<double>(char const*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, int const*)]+0x68): undefined reference to `wrapper_dgemv_'
/tmp/ccbnLbA0.o: In function `void arma::blas::gemm<double>(char const*, char const*, int const*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, int const*)':
main.cpp:(.text._ZN4arma4blas4gemmIdEEvPKcS3_PKiS5_S5_PKT_S8_S5_S8_S5_S8_PS6_S5_[void arma::blas::gemm<double>(char const*, char const*, int const*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, int const*)]+0x7a): undefined reference to `wrapper_dgemm_'
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗?我手动安装了
我在MacBook Pro 7,1型号上使用Ubuntu 11.04
Mar*_*arc 15
非常感谢osgx!看完他的评论后,我再看了一下README文件!事实证明我在命令中缺少'-O1 -larmadillo'!
这是我用来使它工作的命令:
g++ example1.cpp -o example1 -O1 -larmadillo
Run Code Online (Sandbox Code Playgroud)
愚蠢的错误,我知道....它只是提醒你阅读README是多么重要.
自述文件还提到:
如果您收到链接错误,或者手动安装了Armadillo并且您指定了LAPACK和BLAS可用,则需要显式链接LAPACK和BLAS(或其等效项),例如:
g++ example1.cpp -o example1 -O1 -llapack -lblas
Run Code Online (Sandbox Code Playgroud)
我不必包括'-llapack -lblas',但这可能会帮助其他有类似问题的人.