netmaster19 / libxbee

Automatically exported from code.google.com/p/libxbee
0 stars 0 forks source link

./interface/c++/sample/main.cpp compilation failed #7

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

when try to geenrate the sample executable, it's fails.

What is the expected output? What do you see instead?

g++ ../libxbee.o main.cpp -o main -lxbee 
/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/libxbee.so: undefined 
reference to `sem_init'
/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/libxbee.so: undefined 
reference to `pthread_mutex_trylock'
/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/libxbee.so: undefined 
reference to `clock_gettime'
/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/libxbee.so: undefined 
reference to `pthread_key_create'
/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/libxbee.so: undefined 
reference to `sem_destroy'
/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/libxbee.so: undefined 
reference to `pthread_getspecific'
/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/libxbee.so: undefined 
reference to `sem_timedwait'
/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/libxbee.so: undefined 
reference to `pthread_create'
/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/libxbee.so: undefined 
reference to `pthread_cancel'
/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/libxbee.so: undefined 
reference to `sem_post'
/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/libxbee.so: undefined 
reference to `sem_trywait'
/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/libxbee.so: undefined 
reference to `pthread_detach'
/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/libxbee.so: undefined 
reference to `sem_getvalue'
/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/libxbee.so: undefined 
reference to `pthread_setspecific'
/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/libxbee.so: undefined 
reference to `sem_wait'
/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/libxbee.so: undefined 
reference to `pthread_join'
collect2: ld returned 1 exit status
make: *** [main] Error 1

2. change the makefile to add "-lpthread -lrt" :

run: main
    ./main

main: ../libxbee.o main.cpp
    g++ $^ -o $@ -lxbee -lpthread -lrt

3.- execute again "make", it shows:

g++ ../libxbee.o main.cpp -o main -lxbee -lpthread -lrt
./main
libxbee(): -6 - An I/O request failed

4 .- when I execute the binary generated always said:

libxbee(): -6 - An I/O request failed

What version of the product are you using? On what operating system?

> Ubuntu 11.04

Please provide any additional information below.

Original issue reported on code.google.com by antonio....@gmail.com on 30 May 2012 at 8:59

GoogleCodeExporter commented 8 years ago
I consider this a bug in the new Ubuntu toolchain... but I've fixed it anyway :)
see 10d4908c

As for the error in step #4, are you sure you have the correct serial port 
specified in main.cpp:16 - "/dev/ttyUSB0"

Original comment by attie@attie.co.uk on 30 May 2012 at 9:24

GoogleCodeExporter commented 8 years ago
Yes I test it with the correct /dev/ttyUSB0 port, I can open the xbee pro (868) 
[XBP-08] with a term. Any idea about it? I checked all samples, but Ican't run 
someone without error connection ¿?

Original comment by antonio....@gmail.com on 31 May 2012 at 6:55

GoogleCodeExporter commented 8 years ago
** continued support via email **

Original comment by attie@attie.co.uk on 31 May 2012 at 8:10