We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,459 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Error C2676

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.

3
Contributors
2
Replies
1 Hour
Discussion Span
8 Months Ago
Last Updated
3
Views
yehernpoh
Newbie Poster
1 post since Sep 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

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

Ancient Dragon
Achieved Level 70
Team Colleague
32,158 posts since Aug 2005
Reputation Points: 5,836
Solved Threads: 2,577
Skill Endorsements: 69

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

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

WaltP
Posting Sage w/ dash of thyme
Team Colleague
11,404 posts since May 2006
Reputation Points: 3,421
Solved Threads: 1,055
Skill Endorsements: 37

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0590 seconds using 2.7MB