mlpack / ensmallen

A header-only C++ library for numerical optimization --
http://ensmallen.org
Other
742 stars 120 forks source link

Linking error while calling Optimize function #102

Closed greatsharma closed 5 years ago

greatsharma commented 5 years ago

I am getting linking error while calling Optimize function for any ensmallen optimizer.

I coded as stated in http://ensmallen.org/docs.html, infact I copy pasted the same code but I get linking error while calling the Optimize function.

I am using Windows 10 and Visual studio 2017

I got these linking errors in the SGD.obj file (here SGD is my program name) ->

1>SGD.cpp

1>SGD.obj : error LNK2019: unresolved external symbol sasum_ referenced in function "double cdecl arma::blas::asum(unsigned int64,double const *)" (??$asum@N@blas@arma@@YAN_KPEBN@Z)

1>SGD.obj : error LNK2019: unresolved external symbol dasum_ referenced in function "double cdecl arma::blas::asum(unsigned int64,double const *)" (??$asum@N@blas@arma@@YAN_KPEBN@Z)

1>SGD.obj : error LNK2019: unresolved external symbol snrm2_ referenced in function "double cdecl arma::blas::nrm2(unsigned int64,double const *)" (??$nrm2@N@blas@arma@@YAN_KPEBN@Z)

1>SGD.obj : error LNK2019: unresolved external symbol dnrm2_ referenced in function "double cdecl arma::blas::nrm2(unsigned int64,double const *)" (??$nrm2@N@blas@arma@@YAN_KPEBN@Z)

1>SGD.obj : error LNK2019: unresolved external symbol sdot_ referenced in function "double cdecl arma::blas::dot(unsigned int64,double const ,double const )" (??$dot@N@blas@arma@@YAN_KPEBN1@Z)

1>SGD.obj : error LNK2019: unresolved external symbol ddot_ referenced in function "double cdecl arma::blas::dot(unsigned int64,double const ,double const )" (??$dot@N@blas@arma@@YAN_KPEBN1@Z)

1>SGD.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@@YAXPEBDPEBH1PEBN21212PEAN1@Z)

1>SGD.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@@YAXPEBDPEBH1PEBN21212PEAN1@Z)

1>SGD.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@@YAXPEBDPEBH1PEBN21212PEAN1@Z)

1>SGD.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@@YAXPEBDPEBH1PEBN21212PEAN1@Z)

1>SGD.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@@YAXPEBD0PEBH11PEBN21212PEAN1@Z)

1>SGD.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@@YAXPEBD0PEBH11PEBN21212PEAN1@Z)

1>SGD.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@@YAXPEBD0PEBH11PEBN21212PEAN1@Z)

1>SGD.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@@YAXPEBD0PEBH11PEBN21212PEAN1@Z)

1>SGD.obj : error LNK2019: unresolved external symbol ssyrk_ referenced in function "void __cdecl arma::blas::syrk(char const ,char const ,int const ,int const ,double const ,double const ,int const ,double const ,double ,int const )" (??$syrk@N@blas@arma@@YAXPEBD0PEBH1PEBN212PEAN1@Z)

1>SGD.obj : error LNK2019: unresolved external symbol dsyrk_ referenced in function "void __cdecl arma::blas::syrk(char const ,char const ,int const ,int const ,double const ,double const ,int const ,double const ,double ,int const )" (??$syrk@N@blas@arma@@YAXPEBD0PEBH1PEBN212PEAN1@Z)

1>SGD.obj : error LNK2019: unresolved external symbol sgesdd_ referenced in function "void __cdecl arma::lapack::gesdd(char ,int ,int ,double ,int ,double ,double ,int ,double ,int ,double ,int ,int ,int )" (??$gesdd@N@lapack@arma@@YAXPEADPEAH1PEAN1221212111@Z)

1>SGD.obj : error LNK2019: unresolved external symbol dgesdd_ referenced in function "void __cdecl arma::lapack::gesdd(char ,int ,int ,double ,int ,double ,double ,int ,double ,int ,double ,int ,int ,int )" (??$gesdd@N@lapack@arma@@YAXPEADPEAH1PEAN1221212111@Z)

1>SGD.obj : error LNK2019: unresolved external symbol sgesv_ referenced in function "void __cdecl arma::lapack::gesv(int ,int ,double ,int ,int ,double ,int ,int )" (??$gesv@N@lapack@arma@@YAXPEAH0PEAN00100@Z)

1>SGD.obj : error LNK2019: unresolved external symbol dgesv_ referenced in function "void __cdecl arma::lapack::gesv(int ,int ,double ,int ,int ,double ,int ,int )" (??$gesv@N@lapack@arma@@YAXPEAH0PEAN00100@Z)

1>SGD.obj : error LNK2019: unresolved external symbol cgesv_ referenced in function "void __cdecl arma::lapack::gesv(int ,int ,double ,int ,int ,double ,int ,int )" (??$gesv@N@lapack@arma@@YAXPEAH0PEAN00100@Z)

1>SGD.obj : error LNK2019: unresolved external symbol zgesv_ referenced in function "void __cdecl arma::lapack::gesv(int ,int ,double ,int ,int ,double ,int ,int )" (??$gesv@N@lapack@arma@@YAXPEAH0PEAN00100@Z)

1>SGD.obj : error LNK2019: unresolved external symbol sposv_ referenced in function "void __cdecl arma::lapack::posv(char ,int ,int ,double ,int ,double ,int ,int )" (??$posv@N@lapack@arma@@YAXPEADPEAH1PEAN1211@Z)

1>SGD.obj : error LNK2019: unresolved external symbol dposv_ referenced in function "void __cdecl arma::lapack::posv(char ,int ,int ,double ,int ,double ,int ,int )" (??$posv@N@lapack@arma@@YAXPEADPEAH1PEAN1211@Z)

1>SGD.obj : error LNK2019: unresolved external symbol cposv_ referenced in function "void __cdecl arma::lapack::posv(char ,int ,int ,double ,int ,double ,int ,int )" (??$posv@N@lapack@arma@@YAXPEADPEAH1PEAN1211@Z)

1>SGD.obj : error LNK2019: unresolved external symbol zposv_ referenced in function "void __cdecl arma::lapack::posv(char ,int ,int ,double ,int ,double ,int ,int )" (??$posv@N@lapack@arma@@YAXPEADPEAH1PEAN1211@Z)

1>C:\Users\Gaurav Sharma\Documents\Visual Studio 2017\Projects\ensmallenProjects\SGD\x64\Debug\SGD.exe : fatal error LNK1120: 26 unresolved externals

1>Done building project "SGD.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

rcurtin commented 5 years ago

It looks like you are not linking against Armadillo. Be sure that you are linking against all dependencies of your code. :+1:

mlpack-bot[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions! :+1: