gpt4 book ai didi

linker - Armadillo + BLAS + LAPACK : Linking error?

转载 作者:行者123 更新时间:2023-12-04 16:35:53 26 4
gpt4 key购买 nike

当我尝试编译 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

有人可以帮忙吗?我手动安装
  • BLAS最新版本
  • lapack-3.4.0
  • boost-1.48.0
  • 最新版ATLAS

  • 我在 MacBook Pro 7,1 型号上使用 Ubuntu 11.04

    最佳答案

    非常感谢 osgx!阅读完他的评论后,我又看了看 README 文件!事实证明我在命令中缺少“-O1 -larmadillo”!

    这是我用来让它工作的命令:

    g++ example1.cpp -o example1 -O1 -larmadillo

    愚蠢的错误,我知道......它只是提醒你阅读自述文件是多么重要。

    自述文件还提到:

    如果您遇到链接错误,或者如果 Armadillo 是手动安装的
    并且您指定 LAPACK 和 BLAS 可用,您将
    需要与 LAPACK 和 BLAS(或它们的等价物)明确链接,
    例如:
    g++ example1.cpp -o example1 -O1 -llapack -lblas

    我不必包含“-llapack -lblas”,但也许这会帮助其他遇到类似问题的人。

    关于linker - Armadillo + BLAS + LAPACK : Linking error?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8978742/

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