内部未解决的Cplex netbeans包括(#include“ilcplex / ilocplex.h”)

时间:2017-10-03 13:40:33

标签: c++ netbeans cplex

我在#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;
}

报告的错误是:

 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"

在我修改的项目属性中:

C ++编译器:

包含目录[... / CPLEX / include和... / concert / include]

预处理器[定义IL_STD]

LINKER:

其他库目录[... cplex / lib / x64_windows_vs2015 / stat_mda和... concert / lib / x64_windows_vs2015 / stat_mda]

其他依赖项[cplex1271.lib concert.lib ilocplex.lib]

Librarie [我已经放置了stat_mda文件夹和stat_mdd文件夹中的所有库]

0 个答案:

没有答案