Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Compiling with gcc / MinGW

    Posted Mon April 21, 2008 05:03 AM

    Originally posted by: SystemAdmin


    [alexiscl said:]

    Hi,

    I am using CPLEX with Windows server 2003 X64 system. However, I am not able to install Visual Studio on this computer, due to some restrictions on the user's rights. Then, following a previous topic, I have tried to compile .cpp files by myself, using MinGW and gcc.
    CPLEX can be used in C++, regardless of the compiler/editor you choose.

    I took a modified Linux Makefile reported below.
    SYSTEM    = x64_.net2005_8.0
    LIBFORMAT  = stat_mda

    #------------------------------------------------------------
    #
    # When you adapt this makefile to compile your CPLEX programs
    # please copy this makefile and set CPLEXDIR and CONCERTDIR to
    # the directories where CPLEX and CONCERT are installed.
    #
    #------------------------------------------------------------

    CPLEXDIR      = C:\ILOG\CPLEX102
    CONCERTDIR    = C:\ILOG\Concert24
    # ---------------------------------------------------------------------
    # Compiler selection
    # ---------------------------------------------------------------------
    CCC = gcc

    # ---------------------------------------------------------------------
    # Compiler options
    # ---------------------------------------------------------------------

    CCOPT = -m32 -O -fPIC -fexceptions -DNDEBUG -DIL_STD

    # ---------------------------------------------------------------------
    # Link options and libraries
    # ---------------------------------------------------------------------

    CPLEXBINDIR  = $(CPLEXDIR)\bin\$(BINDIST)
    CPLEXJARDIR  = $(CPLEXDIR)\lib\cplex.jar
    CPLEXLIBDIR  = $(CPLEXDIR)\lib\$(SYSTEM)\$(LIBFORMAT)
    CONCERTLIBDIR = $(CONCERTDIR)\lib\$(SYSTEM)\$(LIBFORMAT)

    CCLNFLAGS = -L$(CPLEXLIBDIR) -lilocplex -lcplex -L$(CONCERTLIBDIR) -lconcert -m32 -lm -lpthread

    all:
    nmake all_cpp

    CONCERTINCDIR = $(CONCERTDIR)\include
    CPLEXINCDIR  = $(CPLEXDIR)\include

    EXDIR        = C:\ILOG\CPLEX102\examples
    EXSRC        = $(EXDIR)\src
    EXINC        = $(EXDIR)\include
    EXDATA        = $(EXDIR)\data

    CCFLAGS = $(CCOPT) -I$(CPLEXINCDIR) -I$(CONCERTINCDIR)

    #------------------------------------------------------------
    #  make all      : to compile the examples.
    #------------------------------------------------------------


    CPP_EX = ilodiet
             
    all_cpp: $(CPP_EX)

    # ------------------------------------------------------------

    #clean :
    # /bin/rm -rf *.o *~ *.class
    # /bin/rm -rf $(CPP_EX)
    # /bin/rm -rf *.mps *.ord *.sos *.lp *.sav *.net *.msg *.log *.clp

    # ------------------------------------------------------------
    #
    # The examples
    #

    ilodiet: ilodiet.o
    $(CCC) $(CCFLAGS) ilodiet.o -o ilodiet $(CCLNFLAGS)
    ilodiet.o: $(EXSRC)\ilodiet.cpp
    $(CCC) -c $(CCFLAGS) $(EXSRC)\ilodiet.cpp -o ilodiet.o



    However, I am getting the following error:
    C:\ILOG\CPLEX102\examples\src\ilodiet.cpp:1: warning: -fPIC ignored for target (all code is position independent)
    In file included from C:/ILOG/Concert24/include/ilconcert/iloenv.h:14,
                    from C:/ILOG/Concert24/include/ilconcert/iloalg.h:14,
                    from C:/ILOG/Concert24/include/ilconcert/ilomodel.h:14,
                    from C:/ILOG/CPLEX102/include/ilcplex/ilocplex.h:19,
                    from C:\ILOG\CPLEX102\examples\src\ilodiet.cpp:31:
    C:/ILOG/Concert24/include/ilconcert/ilosys.h:255:23: generic.h: No such file or directory

    Could you confirm than I am able to use any editor? May I have further information regarding compilation if Visual Studio is not used?

    Regards,
    Alexis C.
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Compiling with gcc / MinGW

    Posted Wed April 23, 2008 02:15 AM

    Originally posted by: SystemAdmin


    [MaryFenelon said:]

    You have to use a compiler that is compatible with VC++ in order to use the Concert C++ API.  I don't think gcc/MinGW is compatible.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Compiling with gcc / MinGW

    Posted Sat April 26, 2008 02:24 AM

    Originally posted by: SystemAdmin


    [alexiscl said:]

    Thank you for your reply. I haven't notice than MinGW is not compatible with VC++. I finally ask for a Visual studio version, which will take some time.
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Compiling with gcc / MinGW

    Posted Wed July 16, 2008 10:17 PM

    Originally posted by: SystemAdmin


    [CPXfanatic said:]

    It is possible to use the C API with MinGW and CPLEX. But I don't know about Concert library.

    Try using this compiler option:

    CCOPT = -m32 -O -fPIC -fexceptions -DNDEBUG -DIL_STD -DILO_MSVC

    Try also using a different SYSTEM (possible systems are in the C:\ILOG\CPLEX102\lib directory):

    SYSTEM = msvc7


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Compiling with gcc / MinGW

    Posted Thu August 14, 2008 10:28 PM

    Originally posted by: SystemAdmin


    [dwavesystems said:]

    Hi,

    I'm using CPLEX with Windows XP. I'm trying to compile my C++ program using gcc in MinGW but getting a lot of linking errors, each of which indicates an undefined reference to functions in CPLEX, for example:

    undefined reference to 'operator+(IloNumExprArg, IloNumExprArg)'

    I'm linking my program to the libraries ilocplex and cplex111 in x86_.net2005_8.0\stat_mda in CPLEX111\lib, and also to concert in x86_.net2005_8.0\stat_mda in Concert26\lib.

    Does anyone have any idea why I'm getting those linking errors? Is it because the libraries are not compatible with MinGW?

    Thanks,
    CT
    #CPLEXOptimizers
    #DecisionOptimization