[FWTools] newbie: linking errors with g++ 2.96 and FWTOOLS

Gregory, Matthew matt.gregory at oregonstate.edu
Fri Oct 21 14:44:09 EDT 2005


I've recently moved to Linux (Red Hat 7.3) from Windows and am now using
the FWTOOLS libraries instead of GDAL from source.  In trying to rebuild
my app (which uses GDAL) on the Linux platform using g++, I've run into
a number of linker errors.

My makefile looks like:

=========================================

CC = g++
OBJS = canocoCCAParse.o (etc....)
CFLAGS = -ansi -I include -I FWTools-linux-1.0.0a4/include -I
boost_1_33_0
LDFLAGS = -L FWTools-linux-1.0.0a4/lib

vpath %.cpp src
vpath %.h include FWTools-linux-1.0.0a4/include
vpath %.hpp boost_1_33_0/boost
vpath %.so FWTools-linux-1.0.0a4/lib

all : gnnrun

gnnrun : $(OBJS) -lgdal
        $(CC) -o $@ $(OBJS) $(LDFLAGS) -lgdal

$(OBJS) : %.o : %.cpp
        $(CC) -c $(CFLAGS) $< -o $@

=========================================

I get the following linker errors and warnings:

=========================================

/usr/bin/ld: warning: libgeos.so.2, needed by
FWTools-linux-1.0.0a4/lib/libgdal.so, not found (try using -rpath or
-rpath-link)
/usr/bin/ld: warning: libxerces-c.so.26, needed by
FWTools-linux-1.0.0a4/lib/libgdal.so, not found (try using -rpath or
-rpath-link)
/usr/bin/ld: warning: libNCSEcw.so.0, needed by
FWTools-linux-1.0.0a4/lib/libgdal.so, not found (try using -rpath or
-rpath-link)
/usr/bin/ld: warning: libNCSCnet.so.0, needed by
FWTools-linux-1.0.0a4/lib/libgdal.so, not found (try using -rpath or
-rpath-link)
/usr/bin/ld: warning: libNCSUtil.so.0, needed by
FWTools-linux-1.0.0a4/lib/libgdal.so, not found (try using -rpath or
-rpath-link)
/usr/bin/ld: warning: libogdi31.so, needed by
FWTools-linux-1.0.0a4/lib/libgdal.so, not found (try using -rpath or
-rpath-link)
/usr/bin/ld: warning: libgeotiff.so, needed by
FWTools-linux-1.0.0a4/lib/libgdal.so, not found (try using -rpath or
-rpath-link)
/usr/bin/ld: warning: libgrass5.so.0, needed by
FWTools-linux-1.0.0a4/lib/libgdal.so, not found (try using -rpath or
-rpath-link)
/usr/bin/ld: warning: libpq.so.2, needed by
FWTools-linux-1.0.0a4/lib/libgdal.so, not found (try using -rpath or
-rpath-link)
/usr/bin/ld: warning: libkdu.so, needed by
FWTools-linux-1.0.0a4/lib/libgdal.so, not found (try using -rpath or
-rpath-link)
/usr/bin/ld: warning: libsqlite3.so.0, needed by
FWTools-linux-1.0.0a4/lib/libgdal.so, not found (try using -rpath or
-rpath-link)
/usr/bin/ld: warning: libgcc_s.so.1, needed by
FWTools-linux-1.0.0a4/lib/libgdal.so, not found (try using -rpath or
-rpath-link)
canocoCCAParse.o: In function `CanocoCCAParser::CanocoCCAParser(GnnPList
const &)':
canocoCCAParse.o(.text+0x3f): undefined reference to
`ifstream::ifstream(int)'
canocoCCAParse.o(.text+0x6d): undefined reference to
`ifstream::ifstream(int)'

=========================================

Do I need to include all of the separate .so files when using -lgdal?  I
linked against -lgeos and that error message went away, but I'd be
surprised if this was the correct way to go about it.  The strangest
thing is that I'm getting 'undefined reference' errors to functions in
<iostream> and <fstream> which doesn't seem like it should be happening.


Any help would be greatly appreciated.  Sorry if this has been covered
elsewhere ...

matt



More information about the FWTools mailing list