Armadillo LAPACK包装器未定义引用问题

6
我有一个关于使用Armadillo的问题。
我正在使用Ubuntu 12.10和Code::Blocks中的gcc编译器。我使用synaptic软件包管理器安装了LAPACK和BLAS。我也曾使用CMake手动安装过一次Armadillo。在进行Armadillo编译的配置时,CMake找到了LAPACK和BLAS库。此外,我在Code::Blocks的“构建选项” - > “链接器”中链接了BLAS和LAPACK库。
然而,无论何时我想构建我的项目,都会收到错误消息:
 In function `void arma::lapack::getrf<double>(int*, int*, double*, int*, int*, int*)':|
/usr/include/armadillo_bits/lapack_wrapper.hpp|41|undefined reference to `wrapper_dgetrf_'|

显然这意味着armadillo找不到LAPACK,但我做错了什么吗?
我还取消了armadillo_bits/config.hpp文件中相应行的注释,使其看起来像这样:
    #if !defined(ARMA_USE_LAPACK)
    //#define ARMA_USE_LAPACK
    //// Uncomment the above line if you have LAPACK or a high-speed replacement for LAPACK,
    //// such as Intel MKL, AMD ACML, or the Accelerate framework.
    //// LAPACK is required for matrix decompositions (eg. SVD) and matrix inverse.
    #endif

    #if !defined(ARMA_USE_BLAS)
    //#define ARMA_USE_BLAS
    //// Uncomment the above line if you have BLAS or a high-speed replacement for BLAS,
    //// such as OpenBLAS, GotoBLAS, Intel MKL, AMD ACML, or the Accelerate framework.
    //// BLAS is used for matrix multiplication.
    //// Without BLAS, matrix multiplication will still work, but might be slower.
    #endif

    /* #undef ARMA_USE_WRAPPER */
    //// Comment out the above line if you're getting linking errors when compiling your programs,
    //// or if you prefer to directly link with LAPACK and/or BLAS.
    //// You will then need to link your programs directly with -llapack -lblas instead of -larmadillo

当我尝试使用整数设置矩阵时,首先出现错误。
  Mat<int> element_nodes;

我希望能得到有用的答案。我已经在互联网上搜索了几个小时。如果您需要更多的源代码,请让我知道。

3个回答

2

我几乎可以确定我没有两份Armadillo。我首先删除了所有名称中带有armadillo的文件,然后更新到了最新版本(3.9.x)。但是,Cmake可以找到LAPACK和BLAS,但找不到Armadillo。 - user2477647
谢谢,你的建议使用链接库起作用了。为了更加方便,我将尝试在Code::Blocks内部进行链接。你知道怎么做吗? - user2477647

0

我猜你还没有取消注释定义行!:

if !defined(ARMA_USE_LAPACK)

//#define ARMA_USE_LAPACK
^^
||

这里


0
如果您使用了从下载的armadillo软件包中提取的blas和lapack库文件,可能会出现无法工作的情况,因为在ReadMe文件中指出它们来自第三方,所以我从其他来源下载并编译成功。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接