为什么在 Windows 上安装预编译版本的 LAPACK 时出现错误?

发布于 2024-08-22 22:39:49 字数 8520 浏览 5 评论 0原文

我正在尝试使用犰狳矩阵库进行矩阵计算,它需要 BLAS 和 LAPACK。 Armadillo 文档建议从 http://www.stanford.edu/ 获取预编译版本~vkl/code/libs.html

里面有 .lib.dll 文件。唯一的问题是我不知道如何让 Visual Studio(Express Edition 2008)识别这些文件。我尝试将它们复制到 Visual C++ include 和 lib 目录 C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\C:\Program Files (x86) \Microsoft Visual Studio 9.0\VC\lib\,但它似乎没有做任何事情,因为当我尝试编译我的程序时,我收到很多“无法解析的外部符号”错误,说它找不到LAPACK 函数。

以下是错误消息:

1>Linking...
1>LINK : warning LNK4076: invalid incremental status file 'C:\Users\User\Documents\Visual Studio 2008\Projects\TentPitcher\Debug\TentPitcher.ilk'; linking nonincrementally
1>   Creating library C:\Users\User\Documents\Visual Studio 2008\Projects\TentPitcher\Debug\TentPitcher.lib and object C:\Users\User\Documents\Visual Studio 2008\Projects\TentPitcher\Debug\TentPitcher.exp
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _zgetrf_ referenced in function "void __cdecl arma::lapack::getrf_<double>(int *,int *,double *,int *,int *,int *)" (??$getrf_@N@lapack@arma@@YAXPAH0PAN000@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _zgetrf_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _cgetrf_ referenced in function "void __cdecl arma::lapack::getrf_<double>(int *,int *,double *,int *,int *,int *)" (??$getrf_@N@lapack@arma@@YAXPAH0PAN000@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _cgetrf_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _dgetrf_ referenced in function "void __cdecl arma::lapack::getrf_<double>(int *,int *,double *,int *,int *,int *)" (??$getrf_@N@lapack@arma@@YAXPAH0PAN000@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _dgetrf_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _sgetrf_ referenced in function "void __cdecl arma::lapack::getrf_<double>(int *,int *,double *,int *,int *,int *)" (??$getrf_@N@lapack@arma@@YAXPAH0PAN000@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _sgetrf_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _zgemv_ referenced in function "void __cdecl 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 *)" (??$gemv_@N@blas@arma@@YAXPBDPBH1PBN21212PAN1@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _zgemv_
1>TwoCell3DXT.obj : error LNK2001: unresolved external symbol _zgemv_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _cgemv_ referenced in function "void __cdecl 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 *)" (??$gemv_@N@blas@arma@@YAXPBDPBH1PBN21212PAN1@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _cgemv_
1>TwoCell3DXT.obj : error LNK2001: unresolved external symbol _cgemv_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _dgemv_ referenced in function "void __cdecl 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 *)" (??$gemv_@N@blas@arma@@YAXPBDPBH1PBN21212PAN1@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _dgemv_
1>TwoCell3DXT.obj : error LNK2001: unresolved external symbol _dgemv_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _sgemv_ referenced in function "void __cdecl 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 *)" (??$gemv_@N@blas@arma@@YAXPBDPBH1PBN21212PAN1@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _sgemv_
1>TwoCell3DXT.obj : error LNK2001: unresolved external symbol _sgemv_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _zgemm_ referenced in function "void __cdecl 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 *)" (??$gemm_@N@blas@arma@@YAXPBD0PBH11PBN21212PAN1@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _zgemm_
1>TwoCell3DXT.obj : error LNK2001: unresolved external symbol _zgemm_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _cgemm_ referenced in function "void __cdecl 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 *)" (??$gemm_@N@blas@arma@@YAXPBD0PBH11PBN21212PAN1@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _cgemm_
1>TwoCell3DXT.obj : error LNK2001: unresolved external symbol _cgemm_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _dgemm_ referenced in function "void __cdecl 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 *)" (??$gemm_@N@blas@arma@@YAXPBD0PBH11PBN21212PAN1@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _dgemm_
1>TwoCell3DXT.obj : error LNK2001: unresolved external symbol _dgemm_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _sgemm_ referenced in function "void __cdecl 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 *)" (??$gemm_@N@blas@arma@@YAXPBD0PBH11PBN21212PAN1@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _sgemm_
1>TwoCell3DXT.obj : error LNK2001: unresolved external symbol _sgemm_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _zgetri_ referenced in function "void __cdecl arma::lapack::getri_<double>(int *,double *,int *,int *,double *,int *,int *)" (??$getri_@N@lapack@arma@@YAXPAHPAN00100@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _zgetri_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _cgetri_ referenced in function "void __cdecl arma::lapack::getri_<double>(int *,double *,int *,int *,double *,int *,int *)" (??$getri_@N@lapack@arma@@YAXPAHPAN00100@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _cgetri_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _dgetri_ referenced in function "void __cdecl arma::lapack::getri_<double>(int *,double *,int *,int *,double *,int *,int *)" (??$getri_@N@lapack@arma@@YAXPAHPAN00100@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _dgetri_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _sgetri_ referenced in function "void __cdecl arma::lapack::getri_<double>(int *,double *,int *,int *,double *,int *,int *)" (??$getri_@N@lapack@arma@@YAXPAHPAN00100@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _sgetri_
1>TwoCell3DXT.obj : error LNK2019: unresolved external symbol _dgesvd_ referenced in function "void __cdecl arma::lapack::gesvd_<double>(char *,char *,int *,int *,double *,int *,double *,double *,int *,double *,int *,double *,int *,int *)" (??$gesvd_@N@lapack@arma@@YAXPAD0PAH1PAN122121211@Z)
1>TwoCell3DXT.obj : error LNK2019: unresolved external symbol _sgesvd_ referenced in function "void __cdecl arma::lapack::gesvd_<double>(char *,char *,int *,int *,double *,int *,double *,double *,int *,double *,int *,double *,int *,int *)" (??$gesvd_@N@lapack@arma@@YAXPAD0PAH1PAN122121211@Z)
1>C:\Users\User\Documents\Visual Studio 2008\Projects\TentPitcher\Debug\TentPitcher.exe : fatal error LNK1120: 18 unresolved externals
1>Build log was saved at "file://c:\Users\User\Documents\Visual Studio 2008\Projects\TentPitcher\TentPitcher\Debug\BuildLog.htm"
1>TentPitcher - 43 error(s), 1 warning(s)

Cell3DXT”、“TwoCell3DXT”和“ThreeCell3DXT”是我自己的代码中的类。另外,在上面的 LAPACK 和 BLAS 文件中,还有“.exp 文件”——它们是什么?它们与问题有关系吗?

I am trying to use the Armadillo matrix library to do matrix calculations and it needs BLAS and LAPACK. The Armadillo documentation recommended getting the precompiled versions from http://www.stanford.edu/~vkl/code/libs.html

There are .lib and .dll files in there. The only problem is I don't know how to get Visual Studio (Express Edition 2008) to recognize these files. I try to copy them to the Visual C++ include and lib directories C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\ and C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\, but it doesn't seem to do anything because when I try to compile my program, I get lots of "unresolved external symbol" errors that say it can't find LAPACK functions.

Here are the error messages:

1>Linking...
1>LINK : warning LNK4076: invalid incremental status file 'C:\Users\User\Documents\Visual Studio 2008\Projects\TentPitcher\Debug\TentPitcher.ilk'; linking nonincrementally
1>   Creating library C:\Users\User\Documents\Visual Studio 2008\Projects\TentPitcher\Debug\TentPitcher.lib and object C:\Users\User\Documents\Visual Studio 2008\Projects\TentPitcher\Debug\TentPitcher.exp
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _zgetrf_ referenced in function "void __cdecl arma::lapack::getrf_<double>(int *,int *,double *,int *,int *,int *)" (??$getrf_@N@lapack@arma@@YAXPAH0PAN000@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _zgetrf_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _cgetrf_ referenced in function "void __cdecl arma::lapack::getrf_<double>(int *,int *,double *,int *,int *,int *)" (??$getrf_@N@lapack@arma@@YAXPAH0PAN000@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _cgetrf_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _dgetrf_ referenced in function "void __cdecl arma::lapack::getrf_<double>(int *,int *,double *,int *,int *,int *)" (??$getrf_@N@lapack@arma@@YAXPAH0PAN000@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _dgetrf_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _sgetrf_ referenced in function "void __cdecl arma::lapack::getrf_<double>(int *,int *,double *,int *,int *,int *)" (??$getrf_@N@lapack@arma@@YAXPAH0PAN000@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _sgetrf_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _zgemv_ referenced in function "void __cdecl 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 *)" (??$gemv_@N@blas@arma@@YAXPBDPBH1PBN21212PAN1@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _zgemv_
1>TwoCell3DXT.obj : error LNK2001: unresolved external symbol _zgemv_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _cgemv_ referenced in function "void __cdecl 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 *)" (??$gemv_@N@blas@arma@@YAXPBDPBH1PBN21212PAN1@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _cgemv_
1>TwoCell3DXT.obj : error LNK2001: unresolved external symbol _cgemv_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _dgemv_ referenced in function "void __cdecl 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 *)" (??$gemv_@N@blas@arma@@YAXPBDPBH1PBN21212PAN1@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _dgemv_
1>TwoCell3DXT.obj : error LNK2001: unresolved external symbol _dgemv_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _sgemv_ referenced in function "void __cdecl 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 *)" (??$gemv_@N@blas@arma@@YAXPBDPBH1PBN21212PAN1@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _sgemv_
1>TwoCell3DXT.obj : error LNK2001: unresolved external symbol _sgemv_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _zgemm_ referenced in function "void __cdecl 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 *)" (??$gemm_@N@blas@arma@@YAXPBD0PBH11PBN21212PAN1@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _zgemm_
1>TwoCell3DXT.obj : error LNK2001: unresolved external symbol _zgemm_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _cgemm_ referenced in function "void __cdecl 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 *)" (??$gemm_@N@blas@arma@@YAXPBD0PBH11PBN21212PAN1@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _cgemm_
1>TwoCell3DXT.obj : error LNK2001: unresolved external symbol _cgemm_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _dgemm_ referenced in function "void __cdecl 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 *)" (??$gemm_@N@blas@arma@@YAXPBD0PBH11PBN21212PAN1@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _dgemm_
1>TwoCell3DXT.obj : error LNK2001: unresolved external symbol _dgemm_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _sgemm_ referenced in function "void __cdecl 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 *)" (??$gemm_@N@blas@arma@@YAXPBD0PBH11PBN21212PAN1@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _sgemm_
1>TwoCell3DXT.obj : error LNK2001: unresolved external symbol _sgemm_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _zgetri_ referenced in function "void __cdecl arma::lapack::getri_<double>(int *,double *,int *,int *,double *,int *,int *)" (??$getri_@N@lapack@arma@@YAXPAHPAN00100@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _zgetri_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _cgetri_ referenced in function "void __cdecl arma::lapack::getri_<double>(int *,double *,int *,int *,double *,int *,int *)" (??$getri_@N@lapack@arma@@YAXPAHPAN00100@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _cgetri_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _dgetri_ referenced in function "void __cdecl arma::lapack::getri_<double>(int *,double *,int *,int *,double *,int *,int *)" (??$getri_@N@lapack@arma@@YAXPAHPAN00100@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _dgetri_
1>Cell3DXT.obj : error LNK2019: unresolved external symbol _sgetri_ referenced in function "void __cdecl arma::lapack::getri_<double>(int *,double *,int *,int *,double *,int *,int *)" (??$getri_@N@lapack@arma@@YAXPAHPAN00100@Z)
1>ThreeCell3DXT.obj : error LNK2001: unresolved external symbol _sgetri_
1>TwoCell3DXT.obj : error LNK2019: unresolved external symbol _dgesvd_ referenced in function "void __cdecl arma::lapack::gesvd_<double>(char *,char *,int *,int *,double *,int *,double *,double *,int *,double *,int *,double *,int *,int *)" (??$gesvd_@N@lapack@arma@@YAXPAD0PAH1PAN122121211@Z)
1>TwoCell3DXT.obj : error LNK2019: unresolved external symbol _sgesvd_ referenced in function "void __cdecl arma::lapack::gesvd_<double>(char *,char *,int *,int *,double *,int *,double *,double *,int *,double *,int *,double *,int *,int *)" (??$gesvd_@N@lapack@arma@@YAXPAD0PAH1PAN122121211@Z)
1>C:\Users\User\Documents\Visual Studio 2008\Projects\TentPitcher\Debug\TentPitcher.exe : fatal error LNK1120: 18 unresolved externals
1>Build log was saved at "file://c:\Users\User\Documents\Visual Studio 2008\Projects\TentPitcher\TentPitcher\Debug\BuildLog.htm"
1>TentPitcher - 43 error(s), 1 warning(s)

"Cell3DXT", "TwoCell3DXT", and "ThreeCell3DXT" are classes in my own code. Also in the LAPACK and BLAS files above, there are ".exp files" - what are those and do those have something to do with the problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

杀お生予夺 2024-08-29 22:39:49

我找到了问题的答案。问题是我知道我必须将包含 LAPACK .lib 文件的目录放入库目录列表中(工具 -> 选项 -> 项目和解决方案 -> VC++ 目录 -> 库文件),但忘记了这一点我还必须将其添加到项目 -> 下的“附加依赖项”中(项目名称)属性->链接器->输入。

I figured out the answer to my problem. The problem was that I knew I had to put the directory containing the LAPACK .lib file in the list of library directories (Tools -> Options -> Projects and Solutions -> VC++ Directories -> Library Files) but forgot that I also had to add it to the "Additional Dependencies" under Project -> (Project Name) Properties -> Linker -> Input.

身边 2024-08-29 22:39:49

我遇到了同样的问题,但我解决了如下问题:

  1. 从 victor 的站点下载并提取 LAPACK (LIB+DLL) 和 BLASS (LIB+DLL),
  2. 将 LAPACK 和 BLASS 路径添加到链接器搜索目录,例如“Project->” Code::Blocks 中的“构建选项->搜索目录->链接器”,
  3. 将 lapack_win32.lib 添加到链接器设置,
  4. 在 [Armadillo PATH]/include/armadillo_bits/config.hpp 中取消注释 `#define ARMA_USE_LAPACK'

I had the same problem, but I solved it as follows:

  1. download and extract the LAPACK (LIB+DLL) and BLASS (LIB+DLL)from victor's site,
  2. Add the LAPACK and BLASS paths to linker search directories for example `Project->Build Options->Search Directories->Linker' in Code::Blocks,
  3. Add lapack_win32.lib to Linker Settings,
  4. Uncomment `#define ARMA_USE_LAPACK' in [Armadillo PATH]/include/armadillo_bits/config.hpp
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文