Hello!
I am trying to organize my code since it is becoming too big!!
My simplified main.cpp is:
int main(int argc, char **argv)
{
ampl::AMPL ampl;
setAMPL::readData(ampl);
return 0;
}
Then I have a setAMPL.h file with
#include “ampl/ampl.h” *
namespace setAMPL
{
extern ampl::Parameter iP_tSwi;
void readData(ampl::AMPL &in_ampl);
}
#endif
and a setAMPL.cpp where I would like to set the parameter and function:
#include <setAMPL.h>
ampl::Parameter setAMPL::iP_tSwi;
void setAMPL::readData(ampl::AMPL &in_ampl)
{
in_ampl.read(“./src/ampl/dynamic.mod”);
setAMPL::iP_tSwi = in_ampl.getParameter(“t_swi”);
setAMPL::iP_tSwi.set(10); *
}
I’d like to do this since I might need to modify iP_tSwi in another function after solving…however I get an error
setAMPL.cpp:7:26: error: no matching function for call to ‘ampl::Parameter::Parameter()’
7 | ampl::Parameter setAMPL::iP_tSwi;
What am I doing wrong?? Can use an ampl::Parameter with extern as I would do with a double??
Thank you in advance
Have a nice day
Sam