[Gdal-dev] Re: MinGW & GDAL: "[Linker error] undefined reference..."

J.Krueger kruegerj at gmx.de
Mon Jul 26 03:59:37 EDT 2004


Norman Vine wrote:
>>  "[Linker error] undefined reference to `GDALAllRegister'"
>>  "[Linker error] undefined reference to `GDALOpen'"
> What is the command you are using to link the program
> 
> Note Win32 does not allow undefined symbols so the order of the libraries 
> presented to the linker is important

Here's the Makefile Dev-C++ is creating:

-cut-
# Project: test
# Makefile created by Dev-C++ 4.9.8.9

CPP  = mingw32-g++.exe
CC   = mingw32-gcc.exe
WINDRES = windres.exe
RES  =
OBJ  = main.o $(RES)
LINKOBJ  = main.o $(RES)
LIBS =  -L"C:/Dev-Cpp/lib" -L"C:/Dev-Cpp/gdal/lib"
INCS =  -I"C:/Dev-Cpp/include"
CXXINCS =  -I"C:/Dev-Cpp/include/c++" 
-I"C:/Dev-Cpp/include/c++/mingw32"  -I"C:/Dev-Cpp/include/c++/backward" 
  -I"C:/Dev-Cpp/lib/gcc-lib/mingw32/3.2/include"  -I"C:/Dev-Cpp/include" 
  -I"C:/Dev-Cpp/gdal/include"
BIN  = test.exe
CXXFLAGS = $(CXXINCS)
CFLAGS = $(INCS)

.PHONY: all all-before all-after clean clean-custom

all: all-before test.exe all-after


clean: clean-custom
	rm -f $(OBJ) $(BIN)

$(BIN): $(OBJ)
	$(CPP) $(LINKOBJ) -o "sigma.exe" $(LIBS)

main.o: main.cpp
	$(CPP) -c main.cpp -o main.o $(CXXFLAGS)
-cut-

I tried varying the order of the libraries and the includes, but it 
doesn't change the outcome. :(



More information about the Gdal-dev mailing list