I know this error has been addressed a lot, but until now I couldn't solve it for my project. I am doing a Qt application and want to compile it with the MSVC compiler instead of MinGW (here is the reason).
When I built the programm, I get loads of errors of this kind (just an excerpt):
error: LNK2019: unresolved external symbol sdot_ referenced in function "double __cdecl arma::blas::dot<double>(unsigned int,double const *,double const *)" (??$dot@N@blas@arma@@YANIPEBN0@Z)
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@@YAXPEBDPEBH1PEBN21212PEAN1@Z)
and this warning: LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
.
This thread suggests running qmake and re-building the project, but this didn't change anything.
From here and here and as the warning suggests, I figured I have to change the target machine for the linker. However, everything I found explained it in Visual Studio. How do I do this in Qt Creator?
I would be very thankful for any hints.
EDIT: So my program uses the armadillo library and this is the cause of the problems. When I change compilers, I need to compile or link this library in a new way (right?). This blog post summarized the problem in 2 points (the second point is the cause of the errors):
MSVC cannot directly link to a dll -> we need a so-called “import library”.
Symbol Visibility: GCC/MinGW exports all symbols by default, MSVC exports no symbol by default.
So when using MSVC I have to link the import library (.lib) instead of the .dll in the case of MinGW. How can I do this in QtCreator?
This is my first time going deep with compilers and linkers, so I am very open for corrections, suggestions and solutions!