嗨,正如 README.txt 所说,我在自己的工作目录 /home/me/package/armadillo3.0.1/ 中安装了 Armadillo3.0.1。但是当我尝试一个例子时:
g++ -I /home/me/package/armadillo3.0.1/usr/include/example.cpp -o example -O1
它总是显示错误:
/tmp/ccZAE9pj.o: In function
void arma::gemm<false, false, false, false>::apply_blas_type<double>(arma::Mat<double>&, arma::Mat<double> const&, arma::Mat<double> const&, double, double)': example.cpp:(.text._ZN4arma4gemmILb0ELb0ELb0ELb0EE15apply_blas_typeIdEEvRNS_3MatIT_EERKS5_S8_S4_S4_[void arma::gemm<false, false, false, false>::apply_blas_type<double>(arma::Mat<double>&, arma::Mat<double> const&, arma::Mat<double> const&, double, double)]+0x75e): undefined reference to
wrapper_dgemm_' /tmp/ccZAE9pj.o: In functionvoid arma::glue_times_redirect2_helper<true>::apply<arma::Mat<double>, arma::Mat<double> >(arma::Mat<arma::Mat<double>::elem_type>&, arma::Glue<arma::Mat<double>, arma::Mat<double>, arma::glue_times> const&)': example.cpp:(.text._ZN4arma27glue_times_redirect2_helperILb1EE5applyINS_3MatIdEES4_EEvRNS3_INT_9elem_typeEEERKNS_4GlueIS5_T0_NS_10glue_timesEEE[void arma::glue_times_redirect2_helper<true>::apply<arma::Mat<double>, arma::Mat<double> >(arma::Mat<arma::Mat<double>::elem_type>&, arma::Glue<arma::Mat<double>, arma::Mat<double>, arma::glue_times> const&)]+0xe69): undefined reference to
wrapper_dgemv_' example.cpp:(.text._ZN4arma27glue_times_redirect2_helperILb1EE5applyINS_3MatIdEES4_EEvRNS3_INT_9elem_typeEEERKNS_4GlueIS5_T0_NS_10glue_timesEEE[void arma::glue_times_redirect2_helper::apply, arma::Mat >(arma:: Mat::elem_type>&, arma::Glue, arma::Mat, arma::glue_times> const&)]+0x1175): undefined reference to `wrapper_dgemv_' collect2: ld 返回 1 exit status
但是,如果我添加 -larmadillo 选项,例如:
g++ example.cpp -o 示例 -O1 -larmadillo
它通过调用旧版本来工作。如果我想使用 Mat.t() 等 3.0.1 中的新功能,它也会显示错误:
example.cpp: In function 'int main(int, char**)': example.cpp:20: error: 'struct arma::mat' has no member named 't'</p>
这表明通过添加 -larmadillo,它从 /usr/include/armadillo_bits/ 调用旧版本的犰狳。
有什么想法吗?谢谢。