user1660728
user1660728

Reputation: 11

Cplex in C++: cannot open this source file

I am learning concert technology, I am still at the beginning. I tried to open one of the examples (Ilolpex1.ccp) but when I run it the program says:

#include <ilcplex/ilocplex.h> : cannot open this source file

how can I solve this problem?

Upvotes: 1

Views: 2579

Answers (3)

user5430652
user5430652

Reputation: 1

The problem occurs maybe because you have installed a 32bit version of IBM ILOG CPLEX Optimization Studio on a 64bit Windows. So Visual Studio can't find related header files like "ilcplex".

Upvotes: 0

David Nehme
David Nehme

Reputation: 21597

The message you are seeing is during compilation, not running the program. You need to add the concert and cplex include directories to your include path. The examples are in the directory

<cplex_root_dir>/cplex/examples/src/cpp/

The include files are in

<cplex_root_dir>/cplex/include
<cplex_root_dir>/concert/include

Upvotes: 2

Assuming your C++11 compiler is GCC (on Linux), i.e. g++ command, you could run it as g++ -H to understand what headers are included, and you should add appropriate -I options to give relevant include directories.

Maybe you just need to add e.g. -I /usr/local/include

You might need to add the developer package of your libraries. (e.g. some libfoo-dev package on Debian or Ubuntu)

In practice, you'll better edit some variable in your Makefile, perhaps some CXXFLAGS

Upvotes: 2

Related Questions