Wednesday 15 May 2013

compilation - compile c++ file includes are not being found -



compilation - compile c++ file includes are not being found -

this question has reply here:

what undefined reference/unresolved external symbol error , how prepare it? 23 answers

i geting errors compiling program, reason won't included library.

am using compiler correctly? im listing directories below , output of compiler.

thanks,

im including : #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 `rf24::begin()' test.cpp:(.text+0x24): undefined reference `rf24::setretries(unsigned char, unsigned char)' test.cpp:(.text+0x3c): undefined reference `rf24::setchannel(unsigned char)' test.cpp:(.text+0x48): undefined reference `rf24::setpalevel(unsigned char)' test.cpp:(.text+0x54): undefined reference `rf24::setpalevel(unsigned char)' test.cpp:(.text+0x60): undefined reference `rf24::setdatarate(rf24_datarate_e)' test.cpp:(.text+0x70): undefined reference `rf24::openwritingpipe(unsigned long long)' test.cpp:(.text+0x84): undefined reference `rf24::openreadingpipe(unsigned char, unsigned long long)' test.cpp:(.text+0x8c): undefined reference `rf24::startlistening()' test.cpp:(.text+0x94): undefined reference `rf24::printdetails()' /tmp/ccxhlyku.o: in function `main': test.cpp:(.text+0x138): undefined reference `rf24::stoplistening()' test.cpp:(.text+0x154): undefined reference `rf24::write(void const*, unsigned char)' test.cpp:(.text+0x15c): undefined reference `rf24::startlistening()' test.cpp:(.text+0x164): undefined reference `rf24::available()' test.cpp:(.text+0x180): undefined reference `rf24::read(void*, unsigned char)' /tmp/ccxhlyku.o: in function `__static_initialization_and_destruction_0(int, int)': test.cpp:(.text+0x22c): undefined reference `rf24::rf24(unsigned char, unsigned char, unsigned int)' collect2: ld returned 1 exit status

g++ -wall test.cpp -o test

you not link library.

c++ compilation include

No comments:

Post a Comment