[Shapelib] Linker error with GCC?

Frank Warmerdam warmerdam at pobox.com
Tue Feb 8 14:10:31 EST 2011


On 11-02-07 07:06 PM, Kyle Taylor wrote:
> Hey all,
>
> I stumbled upon shapelib the other day and am really excited about the project.
>   It sounds like a handy lib.  I'm trying to get a feel for it by playing
> around with GCC.  Trouble is, GCC (Fedora 14) is having trouble and can't link
> against shapelib.  shapelib was installed directly out of the YUM repositories,
> and its sitting pretty in /usr/lib64/.  Am I just looking over something really
> dumb, or are other people having similar trouble?
>
> Thanks,
>
> Kyle
>
> ----------
> $ gcc main.cc
>
> /tmp/ccltpct4.o: In function `main':
> main.cc:(.text+0x79): undefined reference to `SHPOpen'
> collect2: ld returned 1 exit status

Kyle,

Try:

   gcc main.c -lshp

You might possibly need to specify the directory in which case it would
be:

   gcc main.c -L/usr/lib64 -lshp

Note that shapelib is also easy to build on it's own from source.  I'm not
really a fan of it being included in distributions.

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    | Geospatial Programmer for Rent



More information about the Shapelib mailing list