Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

Compiling C++ with cplex concert code in Ubuntu linux terminal

  • 1.  Compiling C++ with cplex concert code in Ubuntu linux terminal

    Posted 12/28/15 06:32 AM

    Originally posted by: Mr.EU


    My cplex installed in directory: 

    CPLEXDIR  = /opt/ibm/ILOG/CPLEX_Studio1251/cplex/include
    CONCERTDIR = /opt/ibm/ILOG/CPLEX_Studio1251/concert/include

    I have main.cpp file in:

    /home/user1/Desktop/test/main.cpp

    I want to compile and run from linux terminal, also need a.out(or something similar)

    The Makefile is in location:

    /home/user1/Desktop/test/Makefile

    I followed Question. but unable to compile. Is there any other file required to compile other than Makefile?
    I also tried after previous failure as described here: Link

    This time I got error message:

    In file included from main.cpp:9:0:
    /opt/ibm/ILOG/CPLEX_Studio1251/cplex/include/ilcplex/ilocplex.h:27:32: fatal error: ilconcert/ilomodel.h: No such file or directory
     #include <ilconcert/ilomodel.h>
                                    ^
    compilation terminated.
    

    In my main file, line 9 is:

    #include <ilcplex/ilocplex.h>
    

    I want a single Makefile which will compile the main.cpp and create a.out(executable by ./a.out), which can easily run in terminal.

    Please help. Thank you.


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Compiling C++ with cplex concert code in Ubuntu linux terminal

    Posted 12/29/15 01:52 AM

    You don't need more than a Makefile but you are missing compiler/linker flags: you need to compile at least with -DIL_STD.

    Usually it is best to go to cplex/examples/x86-64_linux/static_pic and run 'make blend'. That will first create the blend.o object file and then the blend binary. It will dump the commands executed. From this you can see which additional compiler/linker flags are required to build a CPLEX application. Alternatively, you can take a look at cplex/examples/x86-64_linux/static_pic/Makefile to see how CPLEX examples are created (or create your own Makefile by copying and then modifying this Makefile).

    If compiler/linker errors persist then please post the complete command lines of the offending commands.


    #CPLEXOptimizers
    #DecisionOptimization