Decision Optimization

Expand all | Collapse all

Linking error in program using CPLEX C++ API on Linux

  • 1.  Linking error in program using CPLEX C++ API on Linux

    Posted Tue January 19, 2021 12:56 PM
      |   view attached

    Hello Dear, I am using the C ++ API for CPLEX 12.9 in Linux / Centos and I perform the execution and linking of the dependencies as follows:

    g++ -std=c++11 main.cpp vrp.cpp vrp.h -I/opt/ibm/ILOG/CPLEX_Studio129/cplex/include -I/opt/ibm/ILOG/CPLEX_Studio129/concert/include -L/opt/ibm/ILOG/CPLEX_Studio129/cplex/lib/x86-64_linux/static_pic -L/opt/ibm/ILOG/CPLEX_Studio129/concert/lib/x86-64_linux/static_pic -o hardprogram

    But I cannot generate the compiled one I get several errors. Will I be linking the dependencies well?

    regards!



    ------------------------------
    affernan
    ------------------------------

    Attachment(s)

    txt
    errolist.txt   10 KB 1 version


  • 2.  RE: Linking error in program using CPLEX C++ API on Linux

    Posted Wed January 20, 2021 07:30 AM
    Edited by Vincent Beraudier Wed January 20, 2021 07:29 AM
    I guess you miss the libraries themselves:
    -lconcert
    -lcplex2010


    ------------------------------
    Vincent Beraudier
    ------------------------------



  • 3.  RE: Linking error in program using CPLEX C++ API on Linux

    Posted Thu January 21, 2021 06:36 AM

    Hello Vincent,

    Thanks for your comments. I saw the examples files like makefile and I understand several components for my syntax, and also including additional libraries at last of my line like -ldl.

    This my line (work fine):

     g++ -std=gnu++11 -O0 -m64 -O -fPIC -fno-strict-aliasing -fexceptions -DNDEBUG -DIL_STD main.cpp vrp.cpp vrp.h -I/opt/ibm/ILOG/CPLEX_Studio129/cplex/include -I/opt/ibm/ILOG/CPLEX_Studio129/concert/include -L/opt/ibm/ILOG/CPLEX_Studio129/cplex/lib/x86-64_linux/static_pic -L/opt/ibm/ILOG/CPLEX_Studio129/concert/lib/x86-64_linux/static_pic -o hardprogram -lconcert -lilocplex -lcplex -lm -lpthread -ldl

    regards,

    Alex



    ------------------------------
    affernan
    ------------------------------