1

i am geting some errors into compiling a program, for some reason it won't get my included library.

am i using the compiler correctly? im listing my directories below and the output of the compiler.

Thanks,

im including like this : #include "lib/RF24/RF24.h"



pi@raspberrypigym ~/sandbox $ ls
examples  lib  Makefile  readme.md  test.cpp

pi@raspberrypigym ~/sandbox/lib $ ls
RF24

pi@raspberrypigym ~/sandbox/lib/RF24 $ ls
bcm2835.c  bcm2835.o           nRF24L01.h     RF24.cpp  RF24.o
bcm2835.h  librf24-bcm.so.1.0  RF24_config.h  RF24.h


pi@raspberrypigym ~/sandbox $ g++ -Wall test.cpp -o test
/tmp/ccXhlYKu.o: In function `setup()':
test.cpp:(.text+0x14): undefined reference to `RF24::begin()'
test.cpp:(.text+0x24): undefined reference to `RF24::setRetries(unsigned char, unsigned char)'
test.cpp:(.text+0x3c): undefined reference to `RF24::setChannel(unsigned char)'
test.cpp:(.text+0x48): undefined reference to `RF24::setPALevel(unsigned char)'
test.cpp:(.text+0x54): undefined reference to `RF24::setPALevel(unsigned char)'
test.cpp:(.text+0x60): undefined reference to `RF24::setDataRate(rf24_datarate_e)'
test.cpp:(.text+0x70): undefined reference to `RF24::openWritingPipe(unsigned long long)'
test.cpp:(.text+0x84): undefined reference to `RF24::openReadingPipe(unsigned char, unsigned long      long)'
test.cpp:(.text+0x8c): undefined reference to `RF24::startListening()'
test.cpp:(.text+0x94): undefined reference to `RF24::printDetails()'
/tmp/ccXhlYKu.o: In function `main':
test.cpp:(.text+0x138): undefined reference to `RF24::stopListening()'
test.cpp:(.text+0x154): undefined reference to `RF24::write(void const*, unsigned char)'
test.cpp:(.text+0x15c): undefined reference to `RF24::startListening()'
test.cpp:(.text+0x164): undefined reference to `RF24::available()'
test.cpp:(.text+0x180): undefined reference to `RF24::read(void*, unsigned char)'
/tmp/ccXhlYKu.o: In function `__static_initialization_and_destruction_0(int, int)':
test.cpp:(.text+0x22c): undefined reference to `RF24::RF24(unsigned char, unsigned char, unsigned  int)'
collect2: ld returned 1 exit status 
pato.llaguno
  • 741
  • 4
  • 20

1 Answers1

0
g++ -Wall test.cpp -o test

You do not link your library.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055