as I read back, others have faced similar problems, but no solution was given for the problem described below. The symptom: under VS8(+MKL), some "advanced" matrix manipulation functions trigger a multiple-definition linker error for the operator*() if there is a matrix multiplication elsewhere in the code. More than one definition for the matrix-matrix and matrix-vector multiplications get instantiated.
Here I get
itpp_debug.lib(mat.obj) : error LNK2005: "class itpp::Vec<class std::complex<double> > __cdecl itpp::operator*<class std::complex<double> >(class itpp::Mat<class std::complex<double> > const &,class itpp::Vec<class std::complex<double> > const &)" (??$?DV?$complex@N@std@@@itpp@@YA?AV?$Vec@V?$complex@N@std@@@0@ABV?$Mat@V?$complex@N@std@@@0@ABV10@@Z) already defined in already.obj
The problem can be circumvented by defining /FORCE:MULTIPLE among the linker options (I even get correct results from a slightly more meaningful program), but... Sometimes also the same but with LNK4006 error instead.
I was unable to trace down the cause, any help appreciated.
Regards.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
as I read back, others have faced similar problems, but no solution was given for the problem described below. The symptom: under VS8(+MKL), some "advanced" matrix manipulation functions trigger a multiple-definition linker error for the operator*() if there is a matrix multiplication elsewhere in the code. More than one definition for the matrix-matrix and matrix-vector multiplications get instantiated.
See the following silly example:
int main()
{
cvec v1 = ones_c(2);
cmat m1 = randn_c(2), m2 = m1 * v1;
cmat m3 = sqrtm(m1);
}
Here I get
itpp_debug.lib(mat.obj) : error LNK2005: "class itpp::Vec<class std::complex<double> > __cdecl itpp::operator*<class std::complex<double> >(class itpp::Mat<class std::complex<double> > const &,class itpp::Vec<class std::complex<double> > const &)" (??$?DV?$complex@N@std@@@itpp@@YA?AV?$Vec@V?$complex@N@std@@@0@ABV?$Mat@V?$complex@N@std@@@0@ABV10@@Z) already defined in already.obj
The problem can be circumvented by defining /FORCE:MULTIPLE among the linker options (I even get correct results from a slightly more meaningful program), but... Sometimes also the same but with LNK4006 error instead.
I was unable to trace down the cause, any help appreciated.
Regards.