running c++ example

Forums:

Dr. Gilles

I am trying to run a c++ file by following the instruction on the website and receiving the following error.

 ibex.h:2:26: fatal error: ibex_Affine2.h: No such file or directory

Isn't it supposed to locate header file automatically ? I am trying following example:

#include "iostream"
#include "ibex.h"

using namespace std;

using namespace ibex;

int main(int argc, char** argv) {

  cout << "Hello! This is a C++ program.\n";    

  System system("../benchs/benchs-satisfaction/benchlib2/kolev36.bch");   
  DefaultSolver solver(system,1e-07);
  vector solutions = solver.solve(system.box); // Run the solver
  for (int i=0; i<(solutions.size()); i++)     {         
    cout << "solution n°" << i << ": " << solutions[i] << endl;     
  }
return 0; }

 

I have also tried providing the path using -I/use/local/include but then it gives more complicated error.

Dear Usman
How do you compile your program exactly? Are you using the makefile of the "examples" subfolder ?
Regards,
Gilles

I compiling as: g++ -I/us/rlocal/include -o result file.cpp also tried
g++ file.cpp

OK, so you have two options.

  • either you copy/paste the makefile of the example subfolder to the folder where your file is and type:

make file

  • either you use directly the following command line:

g++ -O3 -DNDEBUG -frounding-math `pkg-config --cflags ibex` -ofile file.cpp `pkg-config --libs ibex`

Note: in both case, you have first to set the PKG_CONFIG_PATH variable as said in the documentation, that is:

export PKG_CONFIG_PATH=[ibex-path]/share/pkgconfig

Gilles
 
 

Dr. Gilles
 
What do you mean by [ibex-path]/share/pkgconfig
I didnt quit get what exactly it should be [ibex-path]? the absolute path ?or /usr/share/pkgconfig ?
Thanks,

Dr. Gilles,
 
I guess I have been able to run the file with success but now when I am running the executable file which is being generated as a result of execution of the following  program I am receiving this error:
terminate called after throwing an instance of 'ibex::UnknownFileException'
Aborted (core dumped)
 
Following is the example I am trying to run:
 
#include "iostream"
#include "ibex.h"

using namespace std;

using namespace ibex;

int main(int argc, char** argv)
{

  cout << "Hello! This is a C++ program.\n";    

 System system("../benchs/benchs-satisfaction/benchlib2/  kolev36.bch");   
  DefaultSolver solver(system,1e-07);
  vector<IntervalVector> solutions = solver.solve(system.box);
  for (int i=0; i<(solutions.size()); i++)     
    {        
    cout << "solution n°" << i << ": " << solutions[i] << endl;     
      }
 }
 
What can be the reason for this?
 
Thanks,

Dear Usman,

You probably inserted a suprious white space in the name of the input file.

Try to replace

System system("../benchs/benchs-satisfaction/benchlib2/  kolev36.bch");  

with

System system("../benchs/benchs-satisfaction/benchlib2/kolev36.bch"); 

 

Gilles

Dear Dr. Gilles,
 
Thank you very much it worked.