[Gdal-dev] MinGW & GDAL: "[Linker error] undefined reference..."
Mario Beauchamp
starged at videotron.ca
Thu May 27 14:59:19 EDT 2004
Hi Jochen,
On Mon, 26 Jul 2004 01:59:32 +0200, Jochen Krüger <kruegerj at gmx.de> wrote:
>Similar error messages are given for any instance where I use one of the
>libraries instructions. I have configured the paths to the includes and
>the library in Dev-C++ correctly, so I must assume that it's something
>with the library I'm using or with the way I'm using it...
I used Dev-C++ to build the gda/ogr apps based on the following makefile:
# Project: gdal-ogr_apps
# Makefile created by Dev-C++ 4.9.8.7
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
RES =
OBJ = ogr/ogrtindex.o $(RES)
LINKOBJ = ogr/ogrtindex.o $(RES)
LIBS = -L/local/bin -lgdal12
INCS =
CXXINCS =
BIN = ogrtindex.exe
CXXFLAGS = $(CXXINCS)-I./port -I./gcore -I./ogr -I./frmts -I./alg -I./ogr/ogrsf_frmts -w -O2
CFLAGS = $(INCS)-I./port -I./gcore -I./ogr -I./frmts -I./alg -I./ogr/ogrsf_frmts -w -O2
.PHONY: all all-before all-after clean clean-custom
all: all-before ogrtindex.exe all-after
clean: clean-custom
rm -f $(OBJ) $(BIN)
$(BIN): $(OBJ)
$(CPP) $(LINKOBJ) -o "ogrtindex.exe" $(LIBS)
ogr/ogrtindex.o: ogr/ogrtindex.cpp
$(CPP) -c ogr/ogrtindex.cpp -o ogr/ogrtindex.o $(CXXFLAGS)
This assumes that the makefile is at the top of the GDAL building tree. Also note the "LIBS" line:
it means that we link directly with the gdal12.dll in /local/bin.
>int main(int argc, char *argv[])
>{
>...
> GDALAllRegister();
> const char* pan_infile=argv[1];
> // Open Pan
> panDataset = (GDALDataset *) GDALOpen( pan_infile, GA_ReadOnly );
> if( panDataset == NULL ) {
> cout << endl << "Pan-Input kann nicht geoeffnet werden!" << endl;
> errorvalue=2;
May I ask what you're trying to do? I see you open a "panDataset": is it for a fusion with an RGB
dataset?
Hope this helps.
--
Mario B.
My Landsat images:
http://pages.infinit.net/starged/landsat/home.html
More information about the Gdal-dev
mailing list