Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

Compilation problem with g++ 4.3 under Ubuntu

  • 1.  Compilation problem with g++ 4.3 under Ubuntu

    Posted Tue December 02, 2008 12:47 PM

    Originally posted by: SystemAdmin


    [jp.dubus said:]

    Hi everybody,

    I have some compilation problem with the concert library for C++ interface of CPLEX, if i write that kind of code :

    // This code is in the file "test.cpp"
    #include <cstring>
    #include <climits>
    #include <ilcplex/ilocplex.h>

    int main(int argc, char** argv) {
      IloEnv env;
      IloNumVarArray varArray(env, 1, - IloInfinity, IloInfinity);
      IloExpr e;
      e += varArray[0];
      env.end();
      return 0;
    }


    And if i'm trying to compile with :

    g++ -o test -I/home/jp/ilog/cplex111/include/ -I/home/jp/ilog/concert26/include/ -L/home/jp/ilog/cplex111/lib/x86_debian4.0_4.1/static_pic/ -L/home/jp/ilog/concert26/lib/x86_debian4.0_4.1/static_pic/ -fPIC -fexceptions -m32 -DNDEBUG -DIL_STD -O -lcplex -lilocplex -lconcert -lm -lpthread test.cpp


    The compilation failed with this output :

    /tmp/cctZRRcg.o: In function `main':
    test.cpp:(.text+0x76): undefined reference to `IloEnv::IloEnv()'
    test.cpp:(.text+0xac): undefined reference to `IloNumVarArray::IloNumVarArray(IloEnv, long, double, double, IloNumVar::Type)'
    test.cpp:(.text+0xcc): undefined reference to `IloExpr::operator+=(IloNumVar)'
    test.cpp:(.text+0xdb): undefined reference to `IloEnvI::~IloEnvI()'
    collect2: ld a retourné 1 code d'état d'exécution


    Someone has an idea to solve this problem ?

    Thank you very much,

    Jean-Philippe Dubus
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Compilation problem with g++ 4.3 under Ubuntu

    Posted Mon December 08, 2008 09:43 PM

    Originally posted by: SystemAdmin


    [EdKlotz said:]

    Try compiling one of the C++ examples that comes with the software distribution first, using the Makefile that is also provided.  Start with that.

    That said, I recent heard from another user that he too got C++ compiler
    errors with Ubuntu, so there may be some inconsistency between the Ubuntu
    C++ compiler and the gcc 4.1 compiler that was used to build the CPLEX distribution.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Compilation problem with g++ 4.3 under Ubuntu

    Posted Tue December 09, 2008 05:15 PM

    Originally posted by: SystemAdmin


    [jp.dubus said:]

    Problem solved (shame on me) : the -lxxx options of g++ were not at the end of my compilation command
    #CPLEXOptimizers
    #DecisionOptimization