I have an error when I run my code at #include "ilcplex/ilocplex.h"
#include "ilcplex/ilocplex.h"
ILOSTLBEGIN
/*
*
*/
int main(int argc, char** argv) {
IloEnv env;
IloModel model(env);
IloNumVarArray x(env);
for(int i = 0; i < 3; i++) {
std::stringstream name;
name << "x_" << i;
x.add(IloNumVar(
env, 0, 1, IloNumVar::Float, name.str().c_str()
));
}
model.add(IloMaximize(env, x[0] + x[1] - x[2])); //objective function
IloRangeArray constraints(env);
constraints.add( x[0] + 2 * x[1] - x[2] <= 2);
constraints.add(-x[0] + x[1] + x[2] >= 1);
model.add(constraints);
//generating a file resuming
IloCplex cplex(model); //necessary to solve
cplex.exportModel("model.lp");
using std::cout; using std::cerr; using std::endl;
if(cplex.solve()) {
cout << "Cplex completed!" << endl;
cout << "Status: " << cplex.getStatus() << endl;
cout << "Obj value: " << cplex.getObjValue() << endl;
cout<< "x values : ";
for(int i=0;i<3;i++)
{
cout << cplex.getValue(x[i])<<endl;
}
} else {
cerr << "Cplex error!" << endl;
cerr << "Status: " << cplex.getStatus() << endl;
cerr << "Cpx status: " << cplex.getCplexStatus() << endl;
}
env.end();
return 0;
}
the reported error is:
c:\program
files\ibm\ilog\cplex_studio1271\concert\include\ilconcert\ilosys.h:262:21:
fatal error: generic.h: No such file or directory
#include "generic.h"
In the project properties I have modified:
C++ compiler :
include directories [.../CPLEX/include and .../concert/include]
preprocessor [definitions IL_STD]
LINKER:
additional library directories [...cplex/lib/x64_windows_vs2015/stat_mda and ...concert/lib/x64_windows_vs2015/stat_mda]
additional dependencies [cplex1271.lib concert.lib ilocplex.lib]
Librarie [I have put all the libraries that were in the stat_mda folders and stat_mdd folders]