[FWTools] Connecting FWTools/OGR to g++

Chris Everhart chris_everhart at hotmail.com
Sat Jul 15 17:05:57 EDT 2006


OK, so I found this:

http://lists.maptools.org/pipermail/fwtools/2006-January/000269.html

and tried it.  I used this code (from the tutorial):
#include "gdal.h"

int main()
{
    GDALDatasetH  hDataset;

    GDALAllRegister();
}

And here is the result (with gcc):
Owner at dworksgis /cygdrive/c/Program Files/FWTools1.0.5
$ gcc -I "C:/Program Files/FWTools1.0.5/include" geotest.cpp
In file included from C:/Program Files/FWTools1.0.5/include/cpl_port.h:156,
                 from C:/Program Files/FWTools1.0.5/include/gdal.h:135,
                 from geotest.cpp:1:
c:/MinGW/include/math.h:672: declaration of C function `float 
_copysign(float,
   float)' conflicts with
c:/MinGW/include/math.h:671: previous declaration `double _copysign(double,
   double)' here
c:/MinGW/include/math.h:673: declaration of C function `long double
   _copysign(long double, long double)' conflicts with
c:/MinGW/include/math.h:672: previous declaration `float _copysign(float,
   float)' here

If I compile it without the include path, the result is this:
$ g++ geotest.cpp -o ogrTest
C:\DOCUME~1\Owner\LOCALS~1\Temp/ccWWcaaa.o(.text+0x1f):geotest.cpp: 
undefined re
ference to `GDALAllRegister'

So I definately need to add the include path, but do I need to somehow 
override the builtin "math.h"?

Thanks,
Christian







>To: Chris Everhart <chris_everhart at hotmail.com>
>CC: fwtools at lists.maptools.org
>Subject: Re: [FWTools] Connecting FWTools/OGR to g++
>Date: Fri, 14 Jul 2006 17:05:09 -0400
>
>Chris Everhart wrote:
>>Frank,
>>
>>Will I have to set any paths?
>
>Chris,
>
>I'm not sure of everything you would need to do, but at the very
>least you would need to add the appropriate FWTools directories to your
>include and library paths:
>
>eg.
>   g++ -I"C:\Program Files\FWTools1.0.5\include" small.cpp \
>     "C:\Program Files\lib\gdal_i.lib" -o small.exe
>
>Best regards,
>--
>---------------------------------------+--------------------------------------
>I set the clouds in motion - turn up   | Frank Warmerdam, 
>warmerdam at pobox.com
>light and sound - activate the windows | http://pobox.com/~warmerdam
>and watch the world go round - Rush    | President OSGF, http://osgeo.org
>

_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/



More information about the FWTools mailing list