My Code Complains of bcm2835 undefined

30 views
Skip to first unread message

Israel Etu

unread,
Jan 31, 2024, 10:24:41 AM1/31/24
to bcm2835
Hello Colleagues,

I wrote a code on Raspberry Pi zero, including the bcm2835.h. It is just a smple code needed to toggle a LED. However, the code would not compile at all. It complains that bcm2835 is not defined thus: "/usr/bin/ld: blinky.c:(.text+0x34): undefined referenc to bcm2835_gpio_fsel".
I have downloaded bcm2835-1.73 and installed using super user privilege, yet it's failing to compile.
Can someone please help me with advice?
Thank you very much in advance.
Israel

Sean ONeill

unread,
Feb 1, 2024, 6:10:54 PM2/1/24
to bcm2835
Hi
How are you compiling the code?
You need to include linker flag   '-lbcm2835'

Israel Etu

unread,
Feb 2, 2024, 1:08:49 AM2/2/24
to bcm...@googlegroups.com
Thank you.
I included the flag and it worked. Another thing was that I was initially compiling it right on the code editor. But now I used the terminal and put 'sudo' before the 'gcc' command and it worked.

--
You received this message because you are subscribed to the Google Groups "bcm2835" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bcm2835+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bcm2835/3f4c7803-b355-4329-b09d-54c2c050e759n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages