RPi.GPIO with C
#1
Related to this thread http://forum.pine64.org/showthread.php?tid=723 I am trying to build and use the functions in C. I copied all files from RPi.GPIO-PineA64/source and I made these files


test.c
Code:
#include "c_gpio.h"
#include "test.h"

int main(void)
{
   printf("testfunktoin()=%i\n", testfunktion());
   
   setup();
   
   return 0;
}
makefile
Code:
HEADERS = test.h c_gpio.h
OBJECTS = test.o c_gpio.o

default: test

%.o: %.c $(HEADERS)
    gcc -c $< -o $@

test: $(OBJECTS)
    gcc $(OBJECTS) -o $@

clean:
    -rm -f $(OBJECTS)
    -rm -f test
test.h
Code:
int testfunktion(void)
{
   return 44;
}


And I get this compile error:
Code:
$ make
gcc test.o c_gpio.o -o test
c_gpio.o: In function `setup':
c_gpio.c:(.text+0x40): undefined reference to `pinea64_found'
c_gpio.c:(.text+0x44): undefined reference to `pinea64_found'
c_gpio.c:(.text+0x2cc): undefined reference to `pinea64_found'
c_gpio.c:(.text+0x2d0): undefined reference to `pinea64_found'
c_gpio.o: In function `clear_event_detect':
c_gpio.c:(.text+0x378): undefined reference to `pinea64_found'
c_gpio.o:c_gpio.c:(.text+0x37c): more undefined references to `pinea64_found' follow
collect2: error: ld returned 1 exit status
makefile:12: recipe for target 'test' failed
make: *** [test] Error 1
  Reply


Messages In This Thread
RPi.GPIO with C - by Wolfenstein - 08-14-2016, 02:26 PM
RE: RPi.GPIO with C - by MarkHaysHarris777 - 08-14-2016, 02:35 PM
RE: RPi.GPIO with C - by KnReLe - 08-22-2016, 02:58 AM
RE: RPi.GPIO with C - by martinayotte - 08-15-2016, 07:21 AM
RE: RPi.GPIO with C - by MarkHaysHarris777 - 08-22-2016, 07:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  RPi.GPIO python module for Pine A64/A64+ aquilegia 98 148,851 10-26-2024, 07:17 AM
Last Post: Garesdq1d
  fm transmitter with gpio weasel18 2 5,492 09-10-2019, 04:28 AM
Last Post: desai_amogh
  How to use dts or other setup to declare gpio pin Interrupt (e.g. a button)? dkebler 1 4,029 06-12-2019, 10:37 AM
Last Post: dkebler
Lightbulb Sample GPIO codes highlighting RPi.GPIO-PineA64 and the PI bus MarkHaysHarris777 6 12,440 06-07-2019, 12:37 AM
Last Post: tllim
Star GPIO, SPI and I2C C++ Lib databit 7 12,548 02-04-2019, 05:45 AM
Last Post: Jeff R
Information Howto: Controlling Pine64 GPIO via the filesystem (sysfs) on linux pfeerick 4 12,820 01-24-2019, 03:36 AM
Last Post: Fifth
  GPIO and SPI SamR1 20 35,222 03-15-2018, 10:32 AM
Last Post: jomoengineer
Question GPIO shockr 7 16,379 03-11-2018, 01:52 AM
Last Post: jomoengineer
  Read GPIO problem shworker 14 24,009 08-17-2017, 01:21 PM
Last Post: martinayotte
  GPIO fiq capability joseph 3 6,819 11-10-2016, 06:07 PM
Last Post: joseph

Forum Jump:


Users browsing this thread: 2 Guest(s)