Hi. I finished one of my projects a couple months ago totalling almost 600 lines of code. It's absolutely unbareable to further develop it. I'm expecting thousands more lines of code before I'm done.
What I need is a .h / .c pair, sounds easy right? nope.
My structure is such that
my.ino
-> #include <esp32_ble.h>
-> -> #include <BLE2902.h>
there is only one line which states #include <BLE2902.h> and it is within my esp32_ble.h
the error is get is
libraries\BLE\BLE2902.cpp.o: In function `BLE2902::BLE2902()':
C:\Users\Paris\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\BLE\src/BLE2902.cpp:17: multiple definition of `BLE2902::BLE2902()'
sketch\src\BLE2902.cpp.o:sketch\src/BLE2902.cpp:17: first defined here
libraries\BLE\BLE2902.cpp.o: In function `BLE2902::BLE2902()':
BLE2902.cpp:(.text._ZN7BLE2902C2Ev+0x0): multiple definition of `BLE2902::BLE2902()'
sketch\src\BLE2902.cpp.o:BLE2902.cpp:(.text._ZN7BLE2902C2Ev+0x0): first defined here
libraries\BLE\BLE2902.cpp.o: In function `BLE2902::getNotifications()':
BLE2902.cpp:(.text._ZN7BLE290216getNotificationsEv+0x0): multiple definition of `BLE2902::getNotifications()'
sketch\src\BLE2902.cpp.o:BLE2902.cpp:(.text._ZN7BLE290216getNotificationsEv+0x0): first defined here
libraries\BLE\BLE2902.cpp.o: In function `BLE2902::getIndications()':
i've been battling this issue for about 4 hours and cannot do it anymore. It's beyond my understanding that a include can only work within the main .ino
I cannot have my header file without #include <BLE2902.h> as i make definitions such as extern BLEServer ^pServer; that are reliant on the BLE library.
#include <Arduino.h>
#include "esp32_ble.h"
void ble_check_connection(){
// disconnecting
if (!deviceConnected && oldDeviceConnected) {
delay(500); // give the bluetooth stack the chance to get things ready
pServer->startAdvertising(); // restart advertising
Serial.println("start advertising");
oldDeviceConnected = deviceConnected;
}
// connecting
if (deviceConnected && !oldDeviceConnected) {
// do stuff here on connecting
oldDeviceConnected = deviceConnected;
}
}
When the board "ESP32 WROVER" is selected things seem to work.
sucks to have spent so much time scratching my head trying to figure out why things weren't working when the problem was a menu selection. Big cheers to Tom as I would have spent even more time chasing my tail looking / debugging code.