Hi!

I am using concert tech to link Cplex with C++ Coding.
There is an error that pop up when I tried to run:
error C2676: binary '+=' : 'IloNumVar' does not define this operator or a conversion to a type acceptable to the predefined operator

Below is a portion of my code:

    for(i=1;i<n_nd+1;i++)
    {
        if(i < n_nd)
        {
            //Start Flow Demand
            for(t=0;t<(n_T-1)*delta;t+=delta)
            {
                h[i] += var_w[i][t];
            }

            sprintf(buf, "Demand balance constraint (%d)", i);
            cst_wdmdbal.add(IloRange(env, 0, h, 0, buf));
        }

        else if(i == n_nd)
        {
            //End Flow Demand
            for(t=0;t<(n_T-1)*delta;t+=delta)
            {
                h[i] += var_v[i][t];
            }
            sprintf(buf, "Demand balance constraint (%d)", i);
            cst_vdmdbal.add(IloRange(env, 0, h, 0, buf));
        }

        else
        {
            for(t=0;t<(n_T-1)*delta;t+=delta)
            {
                var_w[i][t] = 0;
            }
        }
    }

Please do help.

Kind of hard to say what the problem is without knowing the declaration of variables.

error C2676: binary '+=' : 'IloNumVar' does not define this operator

Whatever IloNumVar is, you cannot do a +=. It's obviously not an integer.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.