using pieces of mapserver code

Frank Koormann frank.koormann at intevation.de
Mon Jan 29 08:13:03 EST 2001


Hi Michael, Listers,

* Michael Hearne (mhearne at bellsouth.net) [010129 13:44]:
> Frank - I will include some of the errors which I am seeing below, but I
> believe I understand the problem, which is that I am not including all
> of the subroutines that support the one function I am trying to use. 
> I've tried various things, including the line below, gcc -o test
> mhtest.c *.c, and a perl script to include all C routines in the

If you are familiar with perl - have you already thought about
implementing the required application using the mapscript feature of
mapserver?

> mapserver directory and all of it's subdirectories.  I know these are
> somewhat amateurish attempts to grab all of the routines necessary, but
> the issue is one I have never been able to resolve:  
> 
> How do you include all of the subroutines your program depends on,
> without including all of the subroutines you do not depend on, and
> without iteratively increasing the files you refer to in your command
> line compile or makefile?
> 
> Is this the role of configure or some related program?
> 

No. AFAIK this is something the linker does. The crude version: 
There is a static library libmap.a in the mapserver directory 
after sucessfull compilation. A static library is an archive of 
object files providing some functionality. In mapserver case there
are imore than 20 files collected in the lib. If you use this 
lib, the linker takes the required objects out of the archive ....

However, there might be some dependencies outside the lib.


> -Mike
> 
> gcc -o test mhtest.c mapshape.c maperror.c mapprimitive.c -lm
> /tmp/ccCxtvSX.o: In function `msOpenSHPFile':
> /tmp/ccCxtvSX.o(.text+0x2803): undefined reference to `DBFOpen'
> /tmp/ccCxtvSX.o: In function `msCloseSHPFile':
> /tmp/ccCxtvSX.o(.text+0x29db): undefined reference to `DBFClose'
> /tmp/cc3GM0KN.o: In function `msSetError':
> /tmp/cc3GM0KN.o(.text+0x18d): undefined reference to `chop'
> /tmp/cc12NvLh.o: In function `msImageScanline':
These are in the libmap

> /tmp/cc12NvLh.o(.text+0x1b91): undefined reference to `gdImageSetPixel'
> /tmp/cc12NvLh.o: In function `msImagePolyline':
> /tmp/cc12NvLh.o(.text+0x1cc8): undefined reference to `gdImageLine'
libgd

> /tmp/cc12NvLh.o: In function `msPolygonLabelPoint':
> /tmp/cc12NvLh.o(.text+0x3ccd): undefined reference to
> `msIntersectPointPolygon'
again libmap

you should compile the mapserver an than apply something like

gcc -o test -lmap -lgd mhtest.c

(given the required include files / libs are in your search paths)

Regards,

    Frank

-- 
Frank Koormann                              http://intevation.net/~frank/
 Professional Service around Free Software         http://intevation.net/
 FreeGIS Project                                   http://freegis.org/



More information about the mapserver-users mailing list