views:

759

answers:

3

I am trying to use the Armadillo matrix library to do matrix calcualtions and it needs BLAS and LAPACK. The Armadillo documentation recommended geting the precompiled versions from here:

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), bu it doesn't seem to do anything because when I try to compile my program, I get lots of "unresolved external symbol" errors that says it can't find LAPACK functions.

EDIT:

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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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)

(The "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?

A: 

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.

Alex319
A: 

I have the same problem. Basically whenever I try to use the solve function from Armadillo I would have a "need LAPACK statement" telling me I've got to install LAPACK. I have downloaded the LAPACK LIB+DLL from victor's site and have tried the approach mentioned above. However, it seems that I am still not getting LAPACK installed. Can anyone please give me some help as I am relatively new in programming/visual_studio. In the "Additional Dependencies" do you just put the word lapack_win32?

1) IN the following do I just put $(Program Files (x86))\Microsoft Visual Studio 9.0\Common7\IDE\LAPACK (Tools -> Options -> Projects and Solutions -> VC++ Directories -> Library Files)

2) I have tried putting the whole LAPACK folder into the Header files in my Project Explorer, but it does not work.

Can somebody please give some instructions on how to properly install LAPACK so that it works on my machine. Thanks

A: 

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
Mahmood Amintoosi