PeterO wrote:You need to create a project (if you havn't done so already).
Menu Project / Properties / Build
Add "-l bcm2835" to the end of the Build command .
I am trying to use urg04lx laser scanner on Raspberry Pi 2 use Geany (c language). When scanner receive 10 data, it will need to check whether the data larger than 30mm,if yes light up one LED. So I have to use bcm2835 library and urg library. After many times tries. I changed my build command in Geany to
compile: gcc -Wall -c "%f" -l / home/pi/urg_library/include/c -l bcm2835 -lm working directory: /home/pi/urg_library/samples/c
build: gcc -Wall -o "%e"*h working directory: /home/pi/urg_library/samples/c
make: make working directory: /home/pi/urg_library/samples/c
I can bulid and compile succefully, but make failed. Geany showed:
make (in directory: /home/pi/urg_library/samples/c)
gcc -O2 -I../../include/c -c -o open_urg_sensor.o open_urg_sensor.c
make: Warning: File '../../build_rule.mk' has modification time 40310815 s in the future
gcc -O2 -I../../include/c sensor_parameter.c open_urg_sensor.o ../../src/liburg_c.a -lm `/bin/sh ld_wsock.sh` `/bin/sh ld_setupapi.sh` -o sensor_parameter
gcc -O2 -I../../include/c -c -o get_distance.o get_distance.c
gcc get_distance.o open_urg_sensor.o ../../src/liburg_c.a -lm `/bin/sh ld_wsock.sh` `/bin/sh ld_setupapi.sh` -o get_distance
get_distance.o: In function `main':
get_distance.c:(.text.startup+0x10): undefined reference to `bcm2835_init'
get_distance.c:(.text.startup+0x30): undefined reference to `bcm2835_gpio_fsel'
get_distance.c:(.text.startup+0x38): undefined reference to `bcm2835_gpio_set'
<builtin>: recipe for target 'get_distance' failed
collect2: error: ld returned 1 exit status
make: *** [get_distance] Error 1
What should I do? Thank you very much.