[Lemon-user] Using Lemon with CPLEX 12.71
Noel Farrugia
noel.farrugia.09 at um.edu.mt
Mon Nov 27 10:16:33 CET 2017
Hi,
I managed to solve it by building LEMON using the following cmake command:
cmake -DCMAKE_INSTALL_PREFIX=$HOME/libraries/lemon -DILOG_ROOT_DIR=$HOME/libraries/ILOG/CPLEX_Studio1271 -DILOG_CPLEX_LIBRARY=$HOME/libraries/ILOG/CPLEX_Studio1271/cplex/lib/x86-64_linux/static_pic/libcplex.a -DILOG_CONCERT_LIBRARY=$HOME/libraries/ILOG/CPLEX_Studio1271/concert/lib/x86-64_linux/static_pic/libconcert.a ..
To link lemon with my library I added the following flags when linking:
-L ~/libraries/ILOG/CPLEX_Studio1271/cplex/lib/x86-64_linux/static_pic
-lcplex
-lpthread
An example compile command is:
g++ -o main.out -I $HOME/libraries/lemon/include main.cc -L ~/libraries/lemon/lib -L ~/libraries/ILOG/CPLEX_Studio1271/cplex/lib/x86-64_linux/static_pic -lemon -lglpk -ltinyxml2 -lcplex -lpthread
I am using the ~/libraries directory because that is where I installed both LEMON and CPLEX libraries. So far I have run a very simple LP program and it seems to be working. As a side note, in order to compile my program successfully, I had to include the cplex header file before the lp header file as shown below:
#include <lemon/cplex.h>
#include <lemon/lp.h>
Do not hesitate to contact me should you require further information.
Thanks a lot for your time and reply.
Kind Regards,
Noel
> On 27 Nov 2017, at 10:09, Alpar Juttner <alpar at cs.elte.hu> wrote:
>
> Hi,
>
> The problem with the automatic detection of CPLEX is that it puts the headers and libs into different folders for different versions and I could not find a way to automatically guess the default location. It is hard coded up to version 12.3 in the file cmake/FindCPLEX.cmake.
>
> So you may try to edit this file.
>
> Any feedback (or update of FindCPLEX.cmake) is very welcome.
>
> Regards,
> Alpár
>
>
> On Fri, 2017-11-17 at 19:40 +0100, Noel Farrugia wrote:
>> Hi all,
>>
>> I am trying to use LEMON in conjunction with CPLEX 12.71 however when I am compiling my program I am getting the error:
>>
>> error: ‘CplexLp’ does not name a type
>> typedef CplexLp Lp;
>>
>> To solve this error I included the CplexLp header file before the general Lp header file in one of my header files like so:
>>
>> #include <lemon/cplex.h>
>> #include <lemon/lp.h>
>>
>> However, when I try to compile my program I now get a list of errors similar to the following:
>>
>> cplex.cc:(.text+0x2b1): undefined reference to `CPXfreeprob'
>> cplex.cc:(.text+0x2c4): undefined reference to `CPXcreateprob'
>>
>> I have a hunch that when I am compiling LEMON the CPLEX library is not being linked correctly; however, when I build Lemon no errors are reported. The command I used to compile LEMON is:
>>
>> cmake -DCMAKE_INSTALL_PREFIX=$HOME/libraries/lemon -DILOG_CPLEX_INCLUDE_DIR=$HOME/ILOG/CPLEX_Studio1271/cplex/include/ -DILOG_CPLEX_LIBRARY=$HOME/ILOG/CPLEX_Studio1271/cplex/lib/x86-64_linux/static_pic/libcplex.a -DILOG_CONCERT_LIBRARY=$HOME/ILOG/CPLEX_Studio1271/concert/lib/x86-64_linux/static_pic/libconcert.a -DILOG_CONCERT_INCLUDE_DIR=$HOME/ILOG/CPLEX_Studio1271/concert/include/ ..
>>
>> I had to pass all of the directories as parameters because otherwise Lemon would not detect them all correctly automatically. Does anyone have any pointers what could be the issue please?
>> I think that the issue is with LEMON and not my developed application because my application compiles correctly when using GLPK.
>>
>> Do not hesitate to contact me should you require further information.
>> Thanks a lot for your time. Much appreciated.
>> Kind Regards,
>> Noel
>> _______________________________________________
>> Lemon-user mailing list
>> Lemon-user at lemon.cs.elte.hu <mailto:Lemon-user at lemon.cs.elte.hu>
>> http://lemon.cs.elte.hu/mailman/listinfo/lemon-user <http://lemon.cs.elte.hu/mailman/listinfo/lemon-user>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lemon.cs.elte.hu/pipermail/lemon-user/attachments/20171127/5b912be6/attachment.html>
More information about the Lemon-user
mailing list