help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] glpk Limitation? Or what is the problem


From: Jiří Spitz
Subject: Re: [Help-glpk] glpk Limitation? Or what is the problem
Date: Wed, 19 Jun 2013 17:04:48 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6

Hi!

You are calling C functions from C++. All C code should be embeddes in something like:

#ifdef __cplusplus
extern "C" {
#endif

   int C = 30;
   int H = 30;
   int R = 6;

   glp_prob *lp;

   int ia[1 + C*H*R + C*R], ja[1 + C*H*R + C*R];

   double ar[1 + C*H*R + C*R], z;

#ifdef __cplusplus
  }
#endif

   cout<<"Basic matrices of LP problem are defined"<<"\n";

#ifdef __cplusplus
extern "C" {
#endif

   lp = glp_create_prob();

#ifdef __cplusplus
  }
#endif

Alternatively you can define C++ wrapper functions and call them directly from C++.

Jiri


  int C = 30;
  int H = 30;
  int R = 6;

  glp_prob *lp;

  int ia[1 + C*H*R + C*R], ja[1 + C*H*R + C*R];

  double ar[1 + C*H*R + C*R], z;

  cout<<"Basic matrices of LP problem are defined"<<"\n";

  lp = glp_create_prob();





reply via email to

[Prev in Thread] Current Thread [Next in Thread]