craspberry-pigeanywiringpi

How can I build the file in C++ with wiringPi?


I am trying to run an example program from the wiringPi in C++ in Geany software(called blink.cpp)

This is the code (I did not do it, I took it directly from the wiringPi exmples in order to see how the GPIO from Raspberry Pi works):

#include <stdio.h>
#include <wiringPi.h>

// LED Pin - wiringPi pin 0 is BCM_GPIO 17.

#define LED 0

int main(void) {
    printf("Raspberry Pi blink\n");

    wiringPiSetup();
    pinMode(LED, OUTPUT);

    for (;;) {
        digitalWrite(LED, HIGH);  // On
        delay(500);               // mS
        digitalWrite(LED, LOW);   // Off
        delay(500);
    }
    return 0;
}

However, I recieve this message: Error messages

I know that I have to add some path somewhere in order to link the wiringPi with Geany using -lwiringPi but I dont know how. If someone can help me and explain me I would really appreciate it.

Thanks in advance


Solution

  • You are getting linker errors. This means linter can't find library. Link against wiringPI http://wiringpi.com/reference/