[Mapserver-users] Help Requested: Easy "gen2shp" application on RH Linux

Prevett, Larry Prevettl at cochise.edu
Tue Jul 27 17:29:22 EDT 2004


|- Tried to compile gen2shp.c from http://www.intevation.de/~jan/gen2shp

|    RESULT: Found I had to download shapelib and compile that package and was 
|successful with that.  However, was unable to successfully compile gen2shp.c 
|as it didn't seem to be linking the required shapefil.h library.  Could not 
|figure out what I was doing wrong.

Edit gen2shp.c and you can see it is looking for shapefil.h

 #include <libshp/shapefil.h>

that's where your compile errors are coming from. You need
to find some way to tell the compiler where to find that file,
but also the other files gen2shp needs in the shapelib directory.

If you have root access you can do a 
proper edit of /etc/ld.so.conf and run ldconfig,
or create some environment variables in /etc/profile, then
  source /etc/profile
to make the shapelib libraries available to whatever 
programs need it. (See shapelib docs?) 
The environment variables for the shapelib directory could 
also be put in /home/user/.bash_profile )

---------

A quick kludge is to change the angle brackets to quotes

 #include "libshp/shapefil.h"

In the gen2shp-0.3.1 subdirectory, make a symbolic
link to your shapelib install directory as libshp.

ln -s /your/shapelib/dir/ /your/gen2shp/dir/libshp

Edit the Makefile.
Change
gen2shp: gen2shp.c utils.o
[tab]   $(CC) $(CFLAGS) -o $@ -lshp gen2shp.c utils.o

to

gen2shp: gen2shp.c utils.o
[tab]   $(CC) $(CFLAGS) -o $@ gen2shp.c  libshp/shpopen.o libshp/dbfopen.o utils.o

(one line, use a [tab] instead of 8 spaces)

make all

Then it should work. 
Hope this helps!

L. Prevett
Mathematics Instructor
Cochise College, Sierra Vista, AZ, US
prevettl at cochise.edu




More information about the mapserver-users mailing list