[Shapelib] Re: Shapelib Digest, Vol 46, Issue 1
Joaquin Perez Valera
joaquinperezvalera at gmail.com
Sat Feb 16 18:35:30 PST 2008
Now I found the way to call the shapelib functions to my program in C++.
There is a sample of my little code, well I took the code from a
shpcreat.cand rename it as
static char rcsid =
"$Id: shpcreate.c,v 1.5 2002/01/15 14:36:07 warmerda Exp $";
using namespace std;
//Here the program ask for a name
cout << "Name of the new shapefile?: " << endl;
cout << "The program will show the name of the shapefile: " <<
nombre_archivo << endl;
//Here the program creates the shapefile. Gives a name and a type
hSHP = SHPCreate( shape_name.c_str(), nShapeType );
SHPClose( hSHP );
This little program runs in windows with the library in dll and in linux,
but under Linux I must generate and shpopen.o and after compile in this way.
g++ -g shpcreate.cpp shpopen.o -o myprogram
And I have a good result.
The secret was to put include these libraries: cstdlib and string.h.
The way is very easy.
Now I have another problem, but I'll try to solve it myself and if I have
can't I'll ask :)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Shapelib