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