Decision Optimization

Decision Optimization

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

 View Only
  • 1.  gcc complier lpex3.c

    Posted Wed February 22, 2012 11:50 AM

    Originally posted by: yhlvqz


    I used gcc to run lpex3.c example in ILOG cplex

    gcc path/lpex3.c -o lpex3.o -c -fPIC -I/path/ILOG/cplex/include
    then I use vi to open lpex3.o

    but it showed scrambled character.

    I am not sure whether lpex3.c run successfully or not and how I can open .o file.Thanks
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: gcc complier lpex3.c

    Posted Wed February 22, 2012 12:41 PM

    Originally posted by: T_O


    .o are just (temporary) object files. You have to link your program (paths may differ):

    gcc -o lpex3 -L/path/to/cplex/lib/x86-64_sles10_4.1/static_pic lpex3.o -lcplex -lpthread -lm

    Then just run lpex3.

    Best regards,
    Thomas
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: gcc complier lpex3.c

    Posted Wed February 22, 2012 02:13 PM

    Originally posted by: yhlvqz


    hi, Thomas

    Thanks.

    I am trying the compiler as following,

    gcc /path/lpex3.c -o lpex3 -L/path/cplex/lib/x86-64_sles10_4.1/static_pic -I/path/cplex/include -lcplex -lpthread -lm

    It works. I knew -I/path/cplex/include gave the path for ilcplex/cplex.h.
    Would you tell me why -L/path/cplex/lib/x86-64_sles10_4.1/static_pic and -lcplex -lpthread -lm are necessary? Thanks
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: gcc complier lpex3.c

    Posted Wed February 22, 2012 08:15 PM

    Originally posted by: kokuyo


    Hi, vhlvqz,

    Your question is just related to the compiling basics. I think I may be able to answer you.

    -L/path/cplex/lib/x86-64_sles10_4.1/static_pic tells GCC to add this directory to be searched for library programs.

    -lcplex -lpthread -lm tells GCC to link with cplex library, pthread library, and math library respectively.

    Thank you very much.
    #CPLEXOptimizers
    #DecisionOptimization