[gdal-dev] strange problem with compilation

Even Rouault even.rouault at spatialys.com
Mon Oct 13 04:51:17 PDT 2014


On Monday 13 October 2014 13:41:11 Martin Landa wrote:
> Hi,
> 
> 2014-10-13 13:33 GMT+02:00 Martin Landa <landa.martin at gmail.com>:
> > g++ -I /usr/local/include -L /usr/local/lib  -lgdal main.cpp
> > 
> > Error:
> > 
> > undefined reference to GDALAllRegister
> 
> solved,
> 
> g++ mail.cpp -I /usr/local/include -L /usr/local/lib -lgdal
> 
> works (so `-l` after cpp file).
> 
> Strangely g++ 4.7 works on both commands. Only g++ 4.8 fails...

Yes, I've hit similar issues recently. Newer g++ are very picky about the 
order into which arguments appear on the command line for linking. You must 
put -L -l after the file that need them.

> 
> Huh, sorry for the noise, Martin

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list