need some help

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

need some help

calpas calpas
Dear all,

I am writting my first C application to access the shapefile and retrieve some data. I'm trying to use the shapelib to achieve that unfortunately I'm keeping on having the following errors:
    /home/geotema/valatest/src/readshapetest.c:19: undefined reference to `SHPOpen'
    /home/geotema/valatest/src/readshapetest.c:21: undefined reference to `SHPGetInfo'

I cannot figure out what is missing. could anyone help me to sort out this issue???

Cheers



_______________________________________________
Shapelib mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/shapelib
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: need some help

Frank Warmerdam-2
On 11-03-09 06:19 AM, calpas calpas wrote:
> Dear all,
>
> I am writting my first C application to access the shapefile and retrieve some
> data. I'm trying to use the shapelib to achieve that unfortunately I'm keeping
> on having the following errors:
> /home/geotema/valatest/src/readshapetest.c:19: undefined reference to `SHPOpen'
> /home/geotema/valatest/src/readshapetest.c:21: undefined reference to `SHPGetInfo'
>
> I cannot figure out what is missing. could anyone help me to sort out this issue???

Calpas Calpas,

Presumably you are not linking against the shapelib modules.  You
don't give your compile or link information so I can't propose a
variation but basically you will likely need to include the object
code from shapelib in your link in some fashion.  Perhaps by listing
the paths to shpopen.o, dbfopen.o, safileio.o and perhaps shptree.o.

Looking at how the commandline programs in shapelib are linked in
shapelib/Makefile might give you a hint as to how to do so.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

_______________________________________________
Shapelib mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/shapelib
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: need some help

Bugzilla from kyle.a.taylor@gmail.com
In reply to this post by calpas calpas
Link error?  I had a similar problem a few weeks ago.  I didn't know what flag to throw GCC when trying to compile against shapelib as a shared library.

Try:

gcc -lshp /home/geotema/valatest/src/readshapetest.creadshapetest.c -o readshapetest

If that doesn't work, it's probably an issue with how you installed shapelib.  

Kyle

On Wed, Mar 9, 2011 at 6:19 AM, calpas calpas <[hidden email]> wrote:
Dear all,

I am writting my first C application to access the shapefile and retrieve some data. I'm trying to use the shapelib to achieve that unfortunately I'm keeping on having the following errors:
    /home/geotema/valatest/src/readshapetest.c:19: undefined reference to `SHPOpen'
    /home/geotema/valatest/src/readshapetest.c:21: undefined reference to `SHPGetInfo'

I cannot figure out what is missing. could anyone help me to sort out this issue???

Cheers



_______________________________________________
Shapelib mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/shapelib



_______________________________________________
Shapelib mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/shapelib
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re : need some help

calpas calpas
In reply to this post by Frank Warmerdam-2
Dear Frank,

Thanks for your kindly message. I am quite a newbie I dont actually know how to link my program against the shapelib. Can you please provide me with a sample of Makefile that I might try. I'm using the autotools to build the program. I've gone through some tutorial but cannot come through.
thanks for your help

Cheers.



De : Frank Warmerdam <[hidden email]>
À : [hidden email]
Envoyé le : Mer 9 mars 2011, 6h 54min 50s
Objet : Re: [Shapelib] need some help

On 11-03-09 06:19 AM, calpas calpas wrote:
> Dear all,
>
> I am writting my first C application to access the shapefile and retrieve some
> data. I'm trying to use the shapelib to achieve that unfortunately I'm keeping
> on having the following errors:
> /home/geotema/valatest/src/readshapetest.c:19: undefined reference to `SHPOpen'
> /home/geotema/valatest/src/readshapetest.c:21: undefined reference to `SHPGetInfo'
>
> I cannot figure out what is missing. could anyone help me to sort out this issue???

Calpas Calpas,

Presumably you are not linking against the shapelib modules.  You
don't give your compile or link information so I can't propose a
variation but basically you will likely need to include the object
code from shapelib in your link in some fashion.  Perhaps by listing
the paths to shpopen.o, dbfopen.o, safileio.o and perhaps shptree.o.

Looking at how the commandline programs in shapelib are linked in
shapelib/Makefile might give you a hint as to how to do so.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up  | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

_______________________________________________
Shapelib mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/shapelib


_______________________________________________
Shapelib mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/shapelib
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: need some help

cellurl
In reply to this post by calpas calpas
single step down the whole way into the program and you will see what files it wants.
I had the same problem until I single stepped way down down down into the guts.


calpas calpas wrote
Dear all,

I am writting my first C application to access the shapefile and retrieve some
data. I'm trying to use the shapelib to achieve that unfortunately I'm keeping
on having the following errors:

    /home/geotema/valatest/src/readshapetest.c:19: undefined reference to
`SHPOpen'
    /home/geotema/valatest/src/readshapetest.c:21: undefined reference to
`SHPGetInfo'

I cannot figure out what is missing. could anyone help me to sort out this
issue???

Cheers



_______________________________________________
Shapelib mailing list
Shapelib@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/shapelib
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: need some help

cellurl
BTW, I use Eclipse w/ C/C++ option.
It allows single stepping.


cellurl wrote
single step down the whole way into the program and you will see what files it wants.
I had the same problem until I single stepped way down down down into the guts.


calpas calpas wrote
Dear all,

I am writting my first C application to access the shapefile and retrieve some
data. I'm trying to use the shapelib to achieve that unfortunately I'm keeping
on having the following errors:

    /home/geotema/valatest/src/readshapetest.c:19: undefined reference to
`SHPOpen'
    /home/geotema/valatest/src/readshapetest.c:21: undefined reference to
`SHPGetInfo'

I cannot figure out what is missing. could anyone help me to sort out this
issue???

Cheers



_______________________________________________
Shapelib mailing list
Shapelib@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/shapelib
Loading...