Quantcast

Newbie on g++ and gpsd

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

Newbie on g++ and gpsd

MarcusJ
Hi, I feel a bit stupid asking this as it is probably a very simple thing and I'm not sure this is the right place to ask for it.

However, I'm trying to build a program that talks to the GPS on my Gallop43.
I've installed the related packages availble through opkg and I try to write a really simple test program to get started.
I usually don't do much programming in a linux environment so I'm inexperienced when it comes to g++ and the build process.
Here I'm trying to build it natively on the gumstix. I've built a few small things on the gumstix already but not something that makes  use of external libraries.

In the code i include gps.h and try to use some functions from it.
I try to compile by the simple command:
# g++ testGps.c
I get the following output:
/tmp/ccT3JlyM.o: In function `main':
testGps.c:(.text+0xc0): undefined reference to `gps_open_r'
collect2: ld returned 1 exit status


Here I'm expecting that the library contaning the functions isn't found so I try to tell g++ where it is.
I run the following:
# g++ testGps.c -L /usr/lib/ -l libgps
And get:
/usr/lib/gcc/arm-angstrom-linux-gnueabi/4.3.3/../../../../arm-angstrom-linux-gnueabi/bin/ld: cannot find -llibgps
collect2: ld returned 1 exit status


This makes me confused as the library seems to be in the right directory:
# ls -la  /usr/lib/libgps*
-rwxr-xr-x 1 root root    948 Sep 15  2010 /usr/lib/libgps.la
lrwxrwxrwx 1 root root     16 Mar 27 15:12 /usr/lib/libgps.so -> libgps.so.19.0.0
lrwxrwxrwx 1 root root     16 Jan 22 22:09 /usr/lib/libgps.so.19 -> libgps.so.19.0.0
-rwxr-xr-x 1 root root  65972 Sep 15  2010 /usr/lib/libgps.so.19.0.0
-rwxr-xr-x 1 root root    989 Sep 15  2010 /usr/lib/libgpsd.la
lrwxrwxrwx 1 root root     16 Mar 27 15:12 /usr/lib/libgpsd.so -> libgpsd.so.0.0.0
lrwxrwxrwx 1 root root     16 Jan 22 22:09 /usr/lib/libgpsd.so.0 -> libgpsd.so.0.0.0
-rwxr-xr-x 1 root root 232840 Sep 15  2010 /usr/lib/libgpsd.so.0.0.0


What am I doing wrong? Can anyone give me som guidance?

Thanks Marcus
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Newbie on g++ and gpsd

Curtis Olson

Hi Marcus,

Try -lgps (all run together, without the lib and no trailing slash) instead of -l libgps/

The Unix convention for specifying libs makes sense once you understand the logic. :-)

Curt.

On Mar 30, 2012 7:28 AM, "MarcusJ" <[hidden email]> wrote:
Hi, I feel a bit stupid asking this as it is probably a very simple thing and
I'm not sure this is the right place to ask for it.

However, I'm trying to build a program that talks to the GPS on my Gallop43.
I've installed the related packages availble through opkg and I try to write
a really simple test program to get started.
I usually don't do much programming in a linux environment so I'm
inexperienced when it comes to g++ and the build process.
Here I'm trying to build it natively on the gumstix. I've built a few small
things on the gumstix already but not something that makes  use of external
libraries.

In the code i include gps.h and try to use some functions from it.
I try to compile by the simple command:
/# g++ testGps.c /
I get the following output:
//tmp/ccT3JlyM.o: In function `main':
testGps.c:(.text+0xc0): undefined reference to `gps_open_r'
collect2: ld returned 1 exit status/

Here I'm expecting that the library contaning the functions isn't found so I
try to tell g++ where it is.
I run the following:
/# g++ testGps.c -L /usr/lib/ -l libgps/
And get:
//usr/lib/gcc/arm-angstrom-linux-gnueabi/4.3.3/../../../../arm-angstrom-linux-gnueabi/bin/ld:
cannot find -llibgps
collect2: ld returned 1 exit status/

This makes me confused as the library seems to be in the right directory:
/# ls -la  /usr/lib/libgps*
-rwxr-xr-x 1 root root    948 Sep 15  2010 /usr/lib/libgps.la
lrwxrwxrwx 1 root root     16 Mar 27 15:12 /usr/lib/libgps.so ->
libgps.so.19.0.0
lrwxrwxrwx 1 root root     16 Jan 22 22:09 /usr/lib/libgps.so.19 ->
libgps.so.19.0.0
-rwxr-xr-x 1 root root  65972 Sep 15  2010 /usr/lib/libgps.so.19.0.0
-rwxr-xr-x 1 root root    989 Sep 15  2010 /usr/lib/libgpsd.la
lrwxrwxrwx 1 root root     16 Mar 27 15:12 /usr/lib/libgpsd.so ->
libgpsd.so.0.0.0
lrwxrwxrwx 1 root root     16 Jan 22 22:09 /usr/lib/libgpsd.so.0 ->
libgpsd.so.0.0.0
-rwxr-xr-x 1 root root 232840 Sep 15  2010 /usr/lib/libgpsd.so.0.0.0/

What am I doing wrong? Can anyone give me som guidance?

Thanks Marcus

--
View this message in context: http://gumstix.8.n6.nabble.com/Newbie-on-g-and-gpsd-tp4671147p4671147.html
Sent from the Gumstix mailing list archive at Nabble.com.

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
Loading...