Advertisement
silver2row

Making Errors and Learning...in C/C++?

Sep 25th, 2022
1,242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.03 KB | None | 0 0
  1. /usr/bin/ld: /tmp/ccK4sGN3.o: in function `main':
  2. OutputGPIO.c:(.text+0x20): undefined reference to `gpio_open'
  3. /usr/bin/ld: OutputGPIO.c:(.text+0x42): undefined reference to `gpio_write'
  4. /usr/bin/ld: OutputGPIO.c:(.text+0x4e): undefined reference to `gpio_set_direction_output'
  5. /usr/bin/ld: OutputGPIO.c:(.text+0x64): undefined reference to `gpio_close'
  6. collect2: error: ld returned 1 exit status
  7.  
  8. # FROM
  9.  
  10. // basic example for handling input change events
  11.  
  12. #include "sysfs-gpio.h"
  13. #include <stdio.h>
  14.  
  15. int main()
  16. {
  17.        struct Gpio gpio = GPIO_INITIALIZER;
  18.        gpio_open( &gpio, "/sys/class/gpio/gpio51", GPIO_RDWR );
  19.  
  20.        int const timeout_ms = 3000;  // -1 = no timeout
  21.  
  22.        if ( gpio_open_output ) {
  23.                printf( "%d\n", &gpio);
  24.                gpio_write( &gpio, 0 );
  25.                gpio_set_direction_output(&gpio, 1);
  26.        }
  27.        else {
  28.                ( ( &gpio, timeout_ms ) );
  29.        }
  30.        printf( "The LED!\n", timeout_ms );
  31.  
  32.        gpio_close( &gpio );
  33.        return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement