Decision Optimization

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

    Posted Tue January 19, 2021 12:56 PM

    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
    ------------------------------

    #DecisionOptimization


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

    Posted Wed January 20, 2021 07:30 AM
    Edited by System Test Fri January 20, 2023 04:49 PM
    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
    ------------------------------



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

    Posted Wed August 28, 2024 12:35 PM

    Do you type this syntax in the terminal 

    also where do you create the main.cpp and how do you run it ??

    as i have installed cplex on linux and i am trying to run the file on visual studio code, it fails, the make blend runs fine and provides the list of dependencies for me 

    g++ -c -m64 -fPIC -fno-strict-aliasing -fexceptions -DNDEBUG -I../../../include -I../../../../concert/include  ../../../examples/src/cpp/blend.cpp -o blend.o
    g++ -m64 -fPIC -fno-strict-aliasing -fexceptions -DNDEBUG -I../../../include -I../../../../concert/include  -L../../../lib/x86-64_linux/static_pic -L../../../../concert/lib/x86-64_linux/static_pic  -o blend blend.o -lconcert -lilocplex -lcplex -lm -lpthread -ldl

    when i run make blend on the linux terminal and after changing the directory cd 



    ------------------------------
    Omar Elsherif
    ------------------------------