<div><font class="Apple-style-span" face="arial, helvetica, sans-serif">Hey all, </font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">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?</font></div>
<div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">Thanks, </font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br>
</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">Kyle</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br></font></div><div><font class="Apple-style-span" size="1" face="'courier new', monospace">----------</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace" size="1">$ gcc main.cc</font></div><div><font class="Apple-style-span" face="'courier new', monospace" size="1"><br></font></div><div><font class="Apple-style-span" size="1" face="'courier new', monospace"><div>
/tmp/ccltpct4.o: In function `main':</div><div>main.cc:(.text+0x79): undefined reference to `SHPOpen'</div><div>collect2: ld returned 1 exit status</div><div><br></div></font></div><div><font class="Apple-style-span" size="1" face="'courier new', monospace">$ gcc -v </font></div>
<div><font class="Apple-style-span" size="1" face="'courier new', monospace"><div><br></div><div>Using built-in specs.</div><div>COLLECT_GCC=gcc</div><div>COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.5.1/lto-wrapper</div>
<div>Target: x86_64-redhat-linux</div><div>Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=<a href="http://bugzilla.redhat.com/bugzilla">http://bugzilla.redhat.com/bugzilla</a> --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,lto --enable-plugin --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux</div>
<div>Thread model: posix</div><div>gcc version 4.5.1 20100924 (Red Hat 4.5.1-4) (GCC) </div><div><br></div><div>$ ldconfig -p | grep libshp</div><div><div> libshp.so.1 (libc6,x86-64) => /usr/lib64/libshp.so.1</div>
<div> libshp.so (libc6,x86-64) => /usr/lib64/libshp.so</div></div><div><br></div><div>$ cat main.cc</div><div><br></div><div><div>#include <libshp/shapefil.h></div></div><div>#include <stdioh.h></div>
<div><br></div></font></div><div><font class="Apple-style-span" size="1" face="'courier new', monospace">int main(int argc, char *argv[])</font></div><div><font class="Apple-style-span" size="1" face="'courier new', monospace">{</font></div>
<div><font class="Apple-style-span" size="1" face="'courier new', monospace"> char PATH[FILENAME_MAX_LEN];</font></div><div><font class="Apple-style-span" size="1" face="'courier new', monospace"> SHPHandle shapefile;</font></div>
<div><font class="Apple-style-span" size="1" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" size="1" face="'courier new', monospace"> /* read program argv[1] specifying shapefile */</font></div>
<div><font class="Apple-style-span" size="1" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" size="1" face="'courier new', monospace"> if(argc < 2)</font></div>
<div><font class="Apple-style-span" size="1" face="'courier new', monospace"> { printf("%s requires a filepath argument to the .SHP file you wish to analyse.\n", argv[0]); return -1; }</font></div>
<div><font class="Apple-style-span" size="1" face="'courier new', monospace"> else</font></div><div><font class="Apple-style-span" size="1" face="'courier new', monospace"> strncpy(PATH, argv[1], sizeof(PATH));</font></div>
<div><font class="Apple-style-span" size="1" face="'courier new', monospace"> </font></div><div><font class="Apple-style-span" size="1" face="'courier new', monospace"> /* attempt to open shapefile */</font></div>
<div><font class="Apple-style-span" size="1" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" size="1" face="'courier new', monospace"> if(!(shapefile = SHPOpen(PATH, "rb")))</font></div>
<div><font class="Apple-style-span" size="1" face="'courier new', monospace"> { printf("could not open %s for reading. Does the file exist?\n", PATH); return -1; }</font></div><div><font class="Apple-style-span" size="1" face="'courier new', monospace"><br>
</font></div><div><font class="Apple-style-span" size="1" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" size="1" face="'courier new', monospace"> return 0;</font></div>
<div><font class="Apple-style-span" size="1" face="'courier new', monospace">}</font></div><div><br></div>