Good day and happy new year! I actually have a lot of difficulties to solve an issue that I have, may be due to my lacke of knowloedge with C++
I dowloaded and installed a library, on a Raspberry Zero W, to get Radio package and another one to display message on a OLED LCD. RadioHead OLED Both work fine independently.
However, when I receive a Radio data on my Raspberry, I would like to display it on my LCD display.
Let me to provide you the maximum of detail:
First keep in mind that after installing ArduiPi_OLED, some files are copied in /usr/local/include and usr/local/lib/
/usr/local/lib $ ls -ls
total 144
0 lrwxrwxrwx 1 root staff 22 Jan 6 22:54 ArduiPi_OLED.so.1 -> libArduiPi_OLED.so.1.0
0 lrwxrwxrwx 1 root staff 37 Jan 6 22:54 libArduiPi_OLED.so -> /usr/local/lib/libArduiPi_OLED.so.1.0
0 lrwxrwxrwx 1 root staff 37 Jan 6 22:54 libArduiPi_OLED.so.1 -> /usr/local/lib/libArduiPi_OLED.so.1.0
64 -rwxr-xr-x 1 root staff 62692 Jan 6 22:54 libArduiPi_OLED.so.1.0
68 -rw-r--r-- 1 root staff 67576 Jan 7 19:41 libbcm2835.a
4 drwxrwsr-x 3 root staff 4096 Sep 7 17:39 pypy2.7
4 drwxrwsr-x 4 root staff 4096 Dec 31 01:08 python2.7
4 drwxrwsr-x 3 root staff 4096 Sep 7 17:02 python3.5
/usr/local/inlcude:
ls -ls /usr/local/include/
total 100
4 -rw-r--r-- 1 root staff 3931 Jan 6 22:54 Adafruit_GFX.h
8 -rw-r--r-- 1 root staff 7272 Jan 6 22:54 ArduiPi_OLED.h
4 -rw-r--r-- 1 root staff 2474 Jan 6 22:54 ArduiPi_OLED_lib.h
84 -rw-r--r-- 1 root staff 82921 Jan 7 19:41 bcm2835.h
To lunch the script which will listen the data sent by the Radio sender module, I launch the following script after compiling it rf95_server (and it works fine)
As I want to print some small text from the received Radio package, I started by adding the folloiwing in rf95_server.cpp
// For OLED LCD
#include "ArduiPi_OLED_lib.h"
#include "Adafruit_GFX.h"
#include "ArduiPi_OLED.h"
#include <getopt.h>
// Instantiate the display
ArduiPi_OLED display;
and then I compiled from
cd RadioHead/examples/raspi/rf95
sudo make
Unfortunately, my terminal printed me the following message:
g++ rf95_server.o RH_RF95.o RasPi.o RHHardwareSPI.o RHGenericDriver.o RHGenericSPI.o RHSPIDriver.o -lbcm2835 -o rf95_server rf95_server.o: In function
__static_initialization_and_destruction_0(int, int)': rf95_server.cpp:(.text+0x438): undefined reference to
ArduiPi_OLED::ArduiPi_OLED()' rf95_server.o: In functionAdafruit_GFX::~Adafruit_GFX()': rf95_server.cpp:(.text._ZN12Adafruit_GFXD2Ev[_ZN12Adafruit_GFXD5Ev]+0x30): undefined reference to
vtable for Adafruit_GFX' rf95_server.o: In functionArduiPi_OLED::~ArduiPi_OLED()': rf95_server.cpp:(.text._ZN12ArduiPi_OLEDD2Ev[_ZN12ArduiPi_OLEDD5Ev]+0x38): undefined reference to
vtable for ArduiPi_OLED' collect2: error: ld returned 1 exit status Makefile:45: recipe for target 'rf95_server' failed make: *** [rf95_server] Error 1
If I comment the following
ArduiPi_OLED display;
There is no error message.
I supposed that the problem is because my rf95_server.cpp can not find a reference to the ArduiPi_OLED library and this is my problem because I do not know how to do it.
First I look to add an option to my make command as
sudo make -I [path-of-ArduiPi_OLED]
I do not know if -I is the correct I do not know how to format the path
- /usr/local/inlcude?
- /usr/local/bin?
- ~/Soft/RadioHead/example/raspi/rf95?
I also tried to modify the Makefile by adding the following before INCLUDE and by modifying the INCLUDE line as the following:
OLEDBASE = ../../../../ArduiPi_OLED
INCLUDE = -I$(RADIOHEADBASE) -I$(OLEDBASE)
but none of this works.
So my question: How can I include ArduiPi_OLED to a rf95_server.cpp script which "belong" to radioHead?
Many Many thank for you help