[FWTools] Compiling using gdal libraries

Mike Toothaker mtoothaker at milcord.com
Fri Jan 12 14:11:34 EST 2007


Thank you very much.  Got it working and seems to be working well.

Thanks

> -----Original Message-----
> From: Mateusz Loskot [mailto:mateusz at loskot.net]
> Sent: Thursday, January 11, 2007 12:23 PM
> To: Mike Toothaker
> Cc: fwtools at lists.maptools.org
> Subject: Re: [FWTools] Compiling using gdal libraries
> 
> Mike Toothaker wrote:
> > I am using the following commandline:
> >
> > g++ Color.cpp -I<path to gdal include> -L<path to gdal libs> -lgdal
> >
> > I am getting a return saying that it is missing a bunch of other libs,
> > surely I don't have to include all of these libs on the commandline, or
> > in my Makefile, do I?
> 
> You shouldn't have to.
> Could you provide some listing with errors you're getting?
> 
> 
> Here is a sample Makefile you can use to build simple programs
> that use GDAL. I use such a makefile myself all the time.
> I customized this version for your Color.cpp,
> just edit /path/to/gdal
> 
> CXX = g++
> CXXFLAGS = -g -Wall -Wno-long-long -pedantic
> LDFLAGS = -L/path/to/gdal -lgdal -lgeos_c -lgeos
> CFLAGS = -I/path/to/gdal/port \
>          -I/path/to/gdal/gcore \
>          -I/path/to/gdal/ogr \
>          -I/path/to/gdal/ogrsf_frmts \
>          $(CXXFLAGS)
> PROGS = color
> 
> all: $(PROGS)
> 
> color: Color.cpp
> 	$(CXX) $(CFLAGS) $< -o $@ $(LDFLAGS)
> 
> 
> If you want to add more programs, copy & paste these lines:
> 
> another: another.cpp
> 	$(CXX) $(CFLAGS) $< -o $@ $(LDFLAGS)
> 
> 
> Cheers
> --
> Mateusz Loskot
> http://mateusz.loskot.net




More information about the FWTools mailing list