I am trying to work with the gpio_lib of cubietruck. Therefore I got the gpio_lib.h
(see https://github.com/youyudehexie/node-cubieboard-gpio/blob/master/lib/gpio_lib.h) file located in my working directory:
> l
gpio_lib.h
test.cpp
In my test.cpp
I have the following include:
#include "gpio_lib.h"
and some calls of the gpio_lib functions like sunxi_gpio_init
and sunxi_gpio_output
within the main()
function.
However if I try to compile and link the send.cpp via
> g++ -o test -O3 -Wall test.cpp
I get
/tmp/ccULAi2f.o: In function `sequence_up()':
test.cpp:(.text+0x26a): undefined reference to `sunxi_gpio_output(unsigned int, unsigned int)'
/tmp/ccULAi2f.o:test.cpp:(.text.startup+0xa2): more undefined references to `sunxi_gpio_output(unsigned int, unsigned int)' follow
collect2: error: ld returned 1 exit status
I also tried following calls getting the same error:
> g++ -o test -O3 -Wall gpio_lib.h test.cpp
> g++ -o test -O3 -Wall -I. -L. gpio_lib.h test.cpp
What is the correct way to compile and link the test.cpp
?