0
$\begingroup$

I tried a few things but I am not so knowlegable about it. I tried with cmakeLists.txt:

cmake_minimum_required(VERSION 3.5)
project(wpitest)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_VERBOSE_MAKEFILE ON)

# Include headers
include_directories(.)


#here
link_directories(wiringPi)

#target_include_directories(${PROJECT_NAME} wiringPi)

for the blink.cpp file :

#include <iostream>
#include <wiringPi.h>

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

#define LED 4

int main ()
{
  while (1)
  {
      printf ("Raspberry Pi blink\n") ;
wiringPiSetupGpio();
  pinMode (LED, OUTPUT) ;
    digitalWrite (LED, HIGH) ;  // On
    delay (50) ;        // mS
    digitalWrite (LED, LOW) ;   // Off
    delay (50) ;
  }
  return 0 ;
}

$\endgroup$

1 Answer 1

1
$\begingroup$

Check the lib installed sudo apt-get install wiringpi

And try find_library and target_link_libraries

*If you use rpi4, build from github source maybe required.

$\endgroup$
1
  • $\begingroup$ yeah that worked thank you $\endgroup$ Commented Feb 17 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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