I am trying to configure the Eclipse CDT with Cplex. I have followed the following steps:
Given the path of "lib" folder in "concert" "cplex" and "opl" folder
I have also given the path of .a and .so files in these directories But now when I try to compile my code, it is not able to find the library and give errors like this:
g++ -L/home/randomuser/IBMCplex/cplex/lib/x86-64_linux/static_pic -L/home/randomuser/IBMCplex/concert/lib/x86-64_linux/static_pic -o "CplexTest" ./src/CplexTest.o -l/home/randomuser/IBMCplex/concert/lib/x86-64_linux/static_pic/libconcert.a /usr/bin/ld: cannot find -l/home/randomuser/IBMCplex/concert/lib/x86-64_linux/static_pic/libconcert.a collect2: error: ld returned 1 exit status makefile:45: recipe for target 'CplexTest' failed make: *** [CplexTest] Error 1
Can anyone guide me what am I missing here or doing wrong?
The -l
option to g++
does not expect a path as argument. It expects a library name, from which it will form a filename by prepending lib
, appending .a
(or .so
for a dynamic library), and then look for that filename in the paths specified with -L
.
So, when entering your library name, instead of using the full path /home/randomuser/IBMCplex/concert/lib/x86-64_linux/static_pic/libconcert.a
, you should just enter concert
(on the command line it should be -lconcert
).