5

I am trying to use cplex in eclipse in Ubuntu 12.04 but when I include ilocplex.h I get the following error

/opt/ibm/ILOG/CPLEX_Studio124/concert/include/ilconcert/ilosys.h:360:22: fatal error: iostream.h: No such file or directory

The only two includes are written as follows:

#include <ilcplex/ilocplex.h>
#include <iostream>

I would appreciate if anyone could help me with this.

David Nehme
  • 20,665
  • 7
  • 73
  • 114
Shahab
  • 109
  • 2
  • 8

2 Answers2

7

At the time ILOG's Concert library was first released, the older iostream.h headers were still common in C++ compilers, but it supports the standard iostream libraries. To use the standard headers and libraries, you need to define the IL_STD preprocessor symbol. Instructions for defining preprocessor directives in Eclipse/C++ can be found in this question.

Community
  • 1
  • 1
David Nehme
  • 20,665
  • 7
  • 73
  • 114
  • Thank you! I just want to point out that you don't need to specify any value when creating symbol IL_STD – Zach Mar 10 '16 at 10:59
0

Try reading the manual again or look again at the samples. Cplex has supported both the old style iostream.h and the newer C++ iostream standard for at least a decade. I just don't have the manual with me right now to give the full reference.

TimChippingtonDerrick
  • 1,705
  • 1
  • 9
  • 11
  • Actually I didn't find a solution in this manual `http://www-eio.upc.edu/lceio/manuals/cplex-11/pdf/refcppcplex.pdf` but I tried adding `-DIL_STD` to the compiler options and defining `#define IL_STD` before including the file. Now the error is gone, but I am not able to use the classes such as `IloEnv` yet. – Shahab Mar 15 '14 at 16:37
  • Finally I found the solution here: `http://www.cristianonattero.com/blog/2012/05/18/cplex-in-c-using-eclipse-under-linux-ubuntu/` Thanks for your advice. – Shahab Mar 15 '14 at 17:11