08-14-2016, 02:26 PM
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
makefile
test.h
And I get this compile error:
test.c
Code:
#include "c_gpio.h"
#include "test.h"
int main(void)
{
printf("testfunktoin()=%i\n", testfunktion());
setup();
return 0;
}
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
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