samedi 24 janvier 2015

Convert small bit of code from c++11 to c++03?

I'm a social scientist trying to compile C++ code, and hitting small problem I think is trivially easy to fix if you know C++, but inscrutable to me.


Trying to compile on V2008, but my code seems to use some C++11 syntax tricks.


In principle, I think this is solution, but I really don't understand C++ so not sure how to implement.


Code block:



Optimiser::Optimiser(double eps, double delta, unsigned long max_itr, long random_order)
{
this->eps = eps;
this->delta = delta;
this->max_itr = max_itr;
this->random_order = random_order;
}

Optimiser::Optimiser() : Optimiser::Optimiser(1e-5, 1e-2, 1000, 1)
{
//ctor
}


And the error I get (referring to the Optimiser::Optimiser() : Optimiser::Optimiser(1e-5, 1e-2, 1000,1) line) is:



c:\Program Files (x86)\Common Files\Microsoft\Visual C++ for Python\9.0\VC\Include\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
src\Optimiser.cpp(39) : error C2039: '{ctor}' : is not a member of 'Optimiser' include\Optimiser.h(26) : see declaration of 'Optimiser'
src\Optimiser.cpp(40) : error C2614: 'Optimiser' : illegal member initialization: 'Optimiser' is not a base or member
error: command '"c:\Program Files (x86)\Common Files\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe"' failed with exit status 2

Aucun commentaire:

Enregistrer un commentaire