[FlopCpp] problem compiling examples

Michal Kaut mail at michalkaut.net
Wed May 23 08:11:56 EDT 2007


I have found a way around the problem, by using a Makefile for examples 
in another Coin-OR project. Still do not know why the original does not 
work, though.. But I wander why it can't be the same as in the other 
projects (which works OK).

I am attaching a Makefile that works for (my installation of) 
MinGW+MSYS. Note that to use it, one would have to edit the COININCDIR 
and COINLIBDIR entries.


Regards,
Michal Kaut


Michal Kaut wrote:
> Hello,
> 
> I have a problem building the examples, using 
> https://projects.coin-or.org/svn/FlopC++/stable/1.0 on Windows XP with 
> MinGW (gcc 3.4.5) and MSYS.
> 
> The package as such builds OK, including "make test", but when I tried 
> to "make" the examples, none of them compiles (links).
> Is this just me, or is a (known) problem? And if so, is there any 
> (preferably easy) fix?
> 
> These are just the first few error messages I get for "make ampl":
> g++ -g -I../../include -I../include  -L../../lib -L../lib 
> -Wl,-rpath,../../lib -Wl,-rpath,../lib -lFlopCpp -lOsi -lOsiClp -lClp 
> -lOsiCbc -lCbc -lCoinUtils -lCgl  ampl.cpp   -o ampl
> C:/DOCUME~1/kaut/LOCALS~1/Temp/ccQJbaaa.o: In function 
> `main':c:/Appl/Math/Coin-OR/coin-FlopCpp/FlopCpp/examples/ampl.cpp:13: 
> undefined reference to `flopc::MP_model::getDefaultModel()'
> :c:/Appl/Math/Coin-OR/coin-FlopCpp/FlopCpp/examples/ampl.cpp:14: 
> undefined reference to `OsiClpSolverInterface::OsiClpSolverInterface()'
> :c:/Appl/Math/Coin-OR/coin-FlopCpp/FlopCpp/examples/ampl.cpp:14: 
> undefined reference to 
> `OsiCbcSolverInterface::OsiCbcSolverInterface(OsiSolverInterface*, 
> CbcStrategy*)'
> :c:/Appl/Math/Coin-OR/coin-FlopCpp/FlopCpp/examples/ampl.cpp:27: 
> undefined reference to `flopc::MP_set::getEmpty()'
> 
> I do not how important it is, but the makefile in the "examples" 
> directory includes
> IncDir    += $(FlopcDir)/include
> LIBDIRS += $(FlopcDir)/lib
> None of these directories exist.
> 
> 
> Thanks a lot in advance.
> 
> Regards,
> Michal Kaut
> 
> _______________________________________________
> FlopCpp mailing list
> FlopCpp at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/flopcpp
-------------- next part --------------
# Copyright (C) 2006 International Business Machines and others.
# All Rights Reserved.
# This file is distributed under the Common Public License.

# $Id: Makefile.in 726 2006-04-17 04:16:00Z andreasw $

##########################################################################
#    You can modify this example makefile to fit for your own program.   #
#    Usually, you only need to change the five CHANGEME entries below.   #
##########################################################################

# To compile other examples, either changed the following line, or
# add the argument EXAMPLE=problem_name to make
EXAMPLE = aircraft

# CHANGEME: This should be the name of your executable
EXE = $(EXAMPLE).exe

# CHANGEME: Here is the name of all object files corresponding to the source
#           code that you wrote in order to define the problem statement
OBJS =  $(EXAMPLE).o

# CHANGEME: Additional libraries
ADDLIBS =

# CHANGEME: Additional flags for compilation (e.g., include flags)
ADDINCFLAGS =

# CHANGEME: Directory to the sources for the (example) problem definition
# files
SRCDIR = .


##########################################################################
#  Usually, you don't have to change anything below.  Note that if you   #
#  change certain compiler options, you might have to recompile the      #
#  package.                                                              #
##########################################################################

# C++ Compiler command
CXX = g++

# C++ Compiler options
CXXFLAGS = -O3 -fomit-frame-pointer -pipe -DNDEBUG -pedantic-errors \
           -Wimplicit -Wparentheses -Wreturn-type -Wcast-qual -Wall \
           -Wpointer-arith -Wwrite-strings -Wconversion

# additional C++ Compiler options for linking
CXXLINKFLAGS =

# Directory with COIN header files
COININCDIR = /c/Appl/Coin-OR/coin-FlopCpp/include

# Directory with COIN libraries
COINLIBDIR = /c/Appl/Coin-OR/coin-FlopCpp/lib

# Libraries necessary to link with Clp
LIBS = -L$(COINLIBDIR) \
  -lFlopCpp -lOsiCbc -lCbc -lOsiClp -lClp -lCgl -lOsi -lCoinUtils -lm
	`cat $(COINLIBDIR)/cgl_addlibs.txt` \
	`cat $(COINLIBDIR)/osi_addlibs.txt` \
	`cat $(COINLIBDIR)/clp_addlibs.txt` \
	`cat $(COINLIBDIR)/coinutils_addlibs.txt` \

# Necessary Include dirs (we use the CYGPATH_W variables to allow
# compilation with Windows compilers)
INCL =  -I$(COININCDIR) $(ADDINCFLAGS)

# The following is necessary under cygwin, if native compilers are used
CYGPATH_W = echo

# Here we list all possible generated objects or executables to delete them
CLEANFILES = \
	$(EXAMPLE).o $(EXAMPLE).exe

all: $(EXE)

.SUFFIXES: .cpp .c .o .obj

$(EXE): $(OBJS)
#	bla=;\
#	for file in $(OBJS); do bla="$$bla `$(CYGPATH_W) $$file`"; done; \
#	$(CXX) $(CXXLINKFLAGS) $(CXXFLAGS) -o $@ $$bla $(ADDLIBS) $(LIBS)
	$(CXX) $(CXXLINKFLAGS) $(CXXFLAGS) -o $@ $< $(ADDLIBS) $(LIBS)

clean:
	rm -rf $(CLEANFILES)

.cpp.o:
#	$(CXX) $(CXXFLAGS) $(INCL) -c -o $@ `test -f '$<' || echo '$(SRCDIR)/'`$<
	$(CXX) $(CXXFLAGS) $(INCL) -c -o $@ $<


.cpp.obj:
#	$(CXX) $(CXXFLAGS) $(INCL) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(SRCDIR)/$<'; fi`
	$(CXX) $(CXXFLAGS) $(INCL) -c -o $@ $<

.c.o:
#	$(CC) $(CFLAGS) $(INCL) -c -o $@ `test -f '$<' || echo '$(SRCDIR)/'`$<
	$(CC) $(CFLAGS) $(INCL) -c -o $@ $<


.c.obj:
#	$(CC) $(CFLAGS) $(INCL) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(SRCDIR)/$<'; fi`
	$(CC) $(CFLAGS) $(INCL) -c -o $@ $<


More information about the FlopCpp mailing list