r10r / rcswitch-pi

RCSwitch implementation for the Raspberry Pi
199 stars 122 forks source link

Anyone developing this ? #23

Open Dragao75 opened 8 years ago

Dragao75 commented 8 years ago

I am running Ubuntu 16.04 and get a compile error.

make all g++ -DRPI -c -o ../rc-switch/RCSwitch.o ../rc-switch/RCSwitch.cpp g++ -DRPI -c -o send.o send.cpp g++ -DRPI ../rc-switch/RCSwitch.o send.o -o send -lwiringPi /usr/lib/gcc/arm-linux-gnueabihf/5/../../../../lib/libwiringPi.so: undefined reference to pthread_join' /usr/lib/gcc/arm-linux-gnueabihf/5/../../../../lib/libwiringPi.so: undefined reference topthread_create' /usr/lib/gcc/arm-linux-gnueabihf/5/../../../../lib/libwiringPi.so: undefined reference to `pthread_cancel' collect2: error: ld returned 1 exit status Makefile:8: recipe for target 'send' failed make: *\ [send] Error 1

Anyone have a solution? Regards,

thjm commented 8 years ago

I guess you have to link with the pthreads library, so add '-lpthread' to the linker options in the Makefile. Haven't any Ubuntu here to check this

Dragao75 commented 8 years ago

I have added this to the Makefile (I have very little experience with compiling) and that seems to do the trick. Compilation works with only 1 warning. But all 3 programs are compiled.

RFSniffer.cpp: In function ‘int main(int, char**)’: RFSniffer.cpp:50:63: warning: format ‘%i’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat=] printf("Received %i\n", mySwitch.getReceivedValue() ); ^ Although the RFSniffer does not give me the result(s) I was expecting I am very please to be able to continue. (When I run the Sniffer and press any button on the remote It does not receive. But this may be related to the cheap china 433Mhz or a connection issue)

thanks!