SOT icon indicating copy to clipboard operation
SOT copied to clipboard

Error compiling with Visual Studio 2017

Open SanPen opened this issue 8 years ago • 6 comments

Hi,

I have encountered the following error:

Suppression State Error C2664 'arma::Col::Col(const arma::arma_fixed_indicator &,const arma::uword,const eT *)': cannot convert argument 1 from 'double' to 'double *' ...merit_functions.h 58

So in the file merit_functions.h at line 58, vec mWeights = { 0.3, 0.5, 0.8, 0.95 }; cannot be processed correctly.

Plus I had to replace all the and by && and the not by !

I use VS2012.

SanPen avatar May 03 '17 14:05 SanPen

Well, Just a heads up. Your library is only successfully compiled by VS 2017 in windows.

SanPen avatar May 03 '17 14:05 SanPen

VS2017 is the only version I have a chance to test against since I'm not a Windows user. Do you want to help me figure out what has to be changed to get support for older versions of VS as well?

The line vec mWeights = { 0.3, 0.5, 0.8, 0.95 }; should be processed correctly if C++11 support is turned on. We can also change it to doing 4 push_backs if it doesn't work in older versions of VS for some reason.

dme65 avatar May 03 '17 16:05 dme65

I can help you test the library in different VS versions.

I can tell you upfront that the templates are not implemented in the VS compiler until VS2017.

And to make it work in VS2017 I replaced all the and and not by the && and !. I also had to change vec mWeights = { 0.3, 0.5, 0.8, 0.95 }; by

vec mWeights;

//later in the code...
mWeights.set_size(4);
mWeights(0) = 0.3;
mWeights(1) = 0.5;
mWeights(2) = 0.8;
mWeights(3) = 0.98;

I had to do this somewhere else. It's a pity that the programmers have to pay Microsoft agenda for C++. But VS is the only compiler Windows play nice with.

SanPen avatar May 03 '17 18:05 SanPen

Thanks! I'll make some changes and see if I can get it to build in VS 2017.

dme65 avatar May 03 '17 19:05 dme65

I got it to work on VS2015 too.

SanPen avatar May 05 '17 09:05 SanPen

Would it be possible to make a pull request so I can incorporate your changes?

dme65 avatar May 10 '17 00:05 dme65