Sleik
Sleik

Reputation: 351

Using cplex with netbeans c++, Linker Problems

I want to use cplex (version 12.7.1) in a Netbeans c++ (version 8.2) project, running on a linux system.

I followed the advice given here:

https://www.ibm.com/support/knowledgecenter/SSSA5P_12.7.1/ilog.odms.cplex.help/CPLEX/GettingStarted/topics/set_up/GNU_Linux.html and configured my project in the following way:

For the c++ compiler:

Include-Directories: /opt/ibm/ILOG/CPLEX_Studio1271/concert/include;/opt/ibm/ILOG/CPLEX_Studio1271/cplex/include

Preprocessor Definitions: IL_STD

For the Linker:

Additional-Library-Directories: /opt/ibm/ILOG/CPLEX_Studio1271/cplex/lib/x86-64_linux/;/opt/ibm/ILOG/CPLEX_Studio1271/concert/lib/x86-64_linux/

Additional Linker Options: -lilocplex -lconcert

However, I am getting the error message:

/usr/bin/ld: cannot find -lilocplex
/usr/bin/ld: cannot find -lconcert

I am unable to see what I'm missing here, how can I get the linker to find the respective libraries?

Upvotes: 0

Views: 248

Answers (1)

rkersh
rkersh

Reputation: 4465

The options you've listed are partially correct, but there are some important things missing. Below, I'll use <COSDIR> to indicate the directory where CPLEX Optimization Studio is installed (e.g., /opt/ibm/ILOG/CPLEX_Studio1271/ from your example above).

For the C++ compiler:

Include-Directories: <COSDIR>/cplex/include;<COSDIR>/concert/include
Preprocessor Definitions: IL_STD

For the Linker:

Additional-Library-Directories: <COSDIR>/cplex/lib/x86-64_linux/static_pic;<COSDIR>/concert/lib/x86-64_linux/static_pic

Additional Linker Options: -lconcert -lilocplex -lcplex -lm -pthread

This should do the trick (make sure you get those paths exactly right).

Another thing worth trying is the following:

cd <COSDIR>/cplex/examples/x86-64_linux/static_pic
make ilolpex1 2>&1 | tee output.txt

This will compile the ilolpex1 C++ example that is shipped with COS and you'll be able to see all of the options you need to successfully compile on your machine.

Upvotes: 1

Related Questions