简体   繁体   English

使用犰狳时出错

[英]Error while using Armadillo

I have downloaded the latest Armadillo package (3.920) and I am trying to use it on my machine (Ubuntu 12.04). 我已经下载了最新的Armadillo软件包(3.920),并且正在尝试在我的计算机上使用它(Ubuntu 12.04)。 I am following the steps mentioned in the readme.txt file for the installation (cmake ., make, sudo make install). 我正在按照readme.txt文件中提到的步骤进行安装(cmake。,make,sudo make install)。 I have lapack and blas on my system. 我的系统上有lapack和blas。 When I try to run the example provided in the examples directory using: g++ example1.cpp -O2 -larmadillo I get the error: /usr/lib/liblapack.so.3gf: undefined reference to ATL_zptgemm' /usr/lib/liblapack.so.3gf: undefined reference to ATL_scopy' etc 当我尝试使用以下命令运行示例目录中提供的示例时:g ++ example1.cpp -O2 -larmadillo我收到错误:/usr/lib/liblapack.so.3gf:对ATL_zptgemm' /usr/lib/liblapack.so.3gf: undefined reference to未定义引用ATL_zptgemm' /usr/lib/liblapack.so.3gf: undefined reference to ATL_scopy的ATL_zptgemm' /usr/lib/liblapack.so.3gf: undefined reference to

If I try to run the example with g++ example1.cpp -O2 -llpack -lblas -lgfortran I get the error: /tmp/ccOsKhfg.o: In function double arma::blas::dot<double>(unsigned int, double const*, double const*)': example1.cpp:(.text._ZN4arma4blas3dotIdEET_jPKS2_S4_[double arma::blas::dot<double>(unsigned int, double const*, double const*)]+0x36): undefined reference to wrapper_ddot_' /tmp/ccOsKhfg.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*)': example1.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*)]+0x53): undefined reference to wrapper_dgemv_' /tmp/ccOsKhfg.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*)': example1.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*)]+0x61): undefined reference to 如果我尝试使用g ++ example1.cpp -O2 -llpack -lblas -lgfortran运行示例,则会收到错误:/tmp/ccOsKhfg.o:在double arma::blas::dot<double>(unsigned int, double const*, double const*)': example1.cpp:(.text._ZN4arma4blas3dotIdEET_jPKS2_S4_[double arma::blas::dot<double>(unsigned int, double const*, double const*)]+0x36): undefined reference to wrapper_ddot_'/tmp/ccOsKhfg.o:在函数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*)': example1.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*)]+0x53): undefined reference to wrapper_dgemv_'/tmp/ccOsKhfg.o的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*)': example1.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*)]+0x53): undefined reference to :在函数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*)': example1.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*)]+0x61): undefined reference to 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*)': example1.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*)]+0x61): undefined reference to wrapper_dgemm_' 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*)': example1.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*)]+0x61): undefined reference to wrapper_dgemm_'的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*)': example1.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*)]+0x61): undefined reference to

Note that if I comment lines '#define ARMA_USE_LAPACK','#define ARMA_USE_BLAS'in config.hpp I am able to run example 1 but not example 2 as it requires lapack. 请注意,如果我在config.hpp中注释行“ #define ARMA_USE_LAPACK”,“#define ARMA_USE_BLAS”,则可以运行示例1,但不能运行示例2,因为它需要lapack。

Can you please guide me in solving the problem. 您能指导我解决问题吗? Thanks. 谢谢。 Salil 萨里尔

By seeing your question, i think you should type -llapack instead of -llpack. 通过查看您的问题,我认为您应该键入-llapack而不是-llpack。
Without -lgfortan it can work so try that too. 如果没有-lgfortan,它可以工作,所以也可以尝试。

g++ main.cpp -o main -o1 -larmadillo -llapack -lblas g ++ main.cpp -o main -o1 -larmadillo -llapack -lblas

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM