using pieces of mapserver code

Michael Hearne mhearne at bellsouth.net
Mon Jan 29 07:40:25 EST 2001


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
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?

-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':
/tmp/cc12NvLh.o(.text+0x1b91): undefined reference to `gdImageSetPixel'
/tmp/cc12NvLh.o: In function `msImagePolyline':
/tmp/cc12NvLh.o(.text+0x1cc8): undefined reference to `gdImageLine'
/tmp/cc12NvLh.o: In function `msPolygonLabelPoint':
/tmp/cc12NvLh.o(.text+0x3ccd): undefined reference to
`msIntersectPointPolygon'
collect2: ld returned 1 exit status

Frank Koormann wrote:
> 
> Michael,
> 
> * Michael Hearne (mhearne at bellsouth.net) [010128 18:57]:
> > This is almost a C programming question, but I don't know of any groups
> > to which I could address the question other than this one.  Here goes:
> >
> 
> [...]
> 
> >
> > For example, I'm trying to compile the code included at the bottom of
> > this message, and I keep getting 'undefined reference to X' messages.
> 
> The exact message would be helpful.
> 
> [...]
> 
> >
> > Or, could I use (or make) a library out of the C code that is in
> > mapserver and use that?
> >
> >
> [...]
> >
> >       if(msOpenSHPFile(&shpfile, "rb", path, tile, filename) == -1){
> >               printf("Filename %s cannot be opened!\n",filename);
> >       }
> > }
> 
> As already mentioned in a reply to your earlier question (accidently not
> cc'd to the list :( I suggest to have a look at the shapelib
> http://gdal.velocet.ca/projects/shapelib/index.html
> on which the MapServer shapefile read-in is based.
> 
> 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