I am trying to blink a LED on a Raspberry Pi using GPIO 4 (P1.7). Here is my code:

#include <bcm2835.h>
#define PIN RPI_GPIO_P1_7

int main()

    bcm2835_gpio_fsel (PIN, BCM2835_GPIO_FSEL_OUTP);

    while (1)
        bcm2835_gpio_write(PIN, HIGH);
        bcm2835_gpio_write(PIN, LOW);

    return 0;

Now, the problem is when I build this code I got this error:

ledblinking.c: In function ‘main’:
ledblinking.c:9:19: error: ‘RPI_GPIO_P1_7’ undeclared (first use in this function)
ledblinking.c:9:19: note: each undeclared identifier is reported only once for each function it appears in

I have tried to replace this line:

#define PIN RPI_GPIO_P1_7

... With this:

#define PIN RPI_GPIO_P1_11

I mean to use P1.11 in place of P1.7 (which works). So, can any one tell me why I cannot use P1.7?

1 Answer 1


you should replace

#define PIN RPI_GPIO_P1_7


#define PIN RPI_GPIO_P1_07

(see the '0' before '7' ?)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.