I just installed the library libbcm2835 using:
$this->bbcode_second_pass_code('', 'pacman -S libbcm2835')
When I try to compile my example source.c,
$this->bbcode_second_pass_code('', '
#include <bcm2835.h>
#define PIN RPI_GPIO_P1_11
int main(int argc, char **argv)
{
if (!bcm2835_init())
return 1;
bcm2835_gpio_fsel(PIN, BCM2835_GPIO_FSEL_OUTP);
while (1)
{
// Turn it on
bcm2835_gpio_write(PIN, HIGH);
// wait a bit
bcm2835_delay(500);
// turn it off
bcm2835_gpio_write(PIN, LOW);
// wait a bit
bcm2835_delay(500);
}
bcm2835_close();
return 0;
}
')
using:
$this->bbcode_second_pass_code('', 'gcc source.c')
compiler says that it can't find some functions:
$this->bbcode_second_pass_code('', '[root@alarmpi programi-C]# gcc source.c
/tmp/ccQytu5j.o: In function `main':
source.c:(.text+0x14): undefined reference to `bcm2835_init'
source.c:(.text+0x34): undefined reference to `bcm2835_gpio_fsel'
source.c:(.text+0x40): undefined reference to `bcm2835_gpio_write'
source.c:(.text+0x48): undefined reference to `bcm2835_delay'
source.c:(.text+0x54): undefined reference to `bcm2835_gpio_write'
source.c:(.text+0x5c): undefined reference to `bcm2835_delay'
collect2: error: ld returned 1 exit status')
How come this happens - I can confirm that header file is installed in /usr/include/bcm2835.h