I am trying to incorporate some BLE code from a github repository into an existing sketch, but I have run into a snag - the code is written to use the built-in BLE library (for an ESP32 Dev Module) but the compiler in the Cloud Editor chooses a different library.
I have read (and followed) the procedure in other posts, dealing with the issue on IDE 2.x, to add an include for BLEUUID, but I now get the Complier error :-
Multiple libraries were found for "BLEUUID.h"
Used: /run/arduino/directories-data/internal/ESP32_BLE_Arduino_1.0.1_8ea2f3fb01d5c4be
Not used: /run/arduino/directories-data/internal/Seeed_Arduino_rpcBLE_1.0.0_8b4c5e8dbcca40e3
Not used: /run/arduino/directories-data/packages/esp32/hardware/esp32/2.0.17/libraries/BLE
It seems the Cloud Editor is apparently choosing to use a library that has been deprecated for at least 12 months (ESP32_BLE_Arduino_1.0.1), rather than using the built-in library. Am I reading this right, and if so how do I fix it please ?
As a side issue, the error message refers to version 2.0.17 of the built-in library, but the current version is apparently 3.3.2. I thought the idea of Cloud Editor library system meant that libraries were always up to date, so have I misunderstood or is there another problem somewhere ?
I believe this is the library I need, but I have not been able to find a way to force the Cloud Editor to use it.
This created a long string of compiler errors, apparently from Cloud Editor using the wrong library, so I did a forum search and found several replies from ptillisch - eg Ble will not compile post 6, saying -
So change this part of your sketch:
#include <BLEDevice.h>
to this:
#include <BLEUUID.h>
#include <BLEDevice.h>
I now have -
#include "BLEUUID.h" #include "BLEDevice.h"
and I get the compiler error in my first post.
It seems the Cloud Editor is picking the wrong library, and I can’t see how to force it to pick the right one. If I was using IDE 2.x I could probably do it, but I’m not.
I can’t delete a built-in library on Cloud Editor, so ptillisch’s other suggestion doesn’t work.
I can’t see how to download the built-in library from github (the only option seems to be to download the whole board package), so I can’t have a local copy in my sketch folder.
I can’t find the built-in library in a library search on the Cloud Editor, so I can’t set it as a favorite.
I’ve tried expanding on what ptillisch said in the text of his reply and looking for differences between the two libraries, then adding another include for something that’s only in the built-in one (eg BLE2901.h). I get “no such file or directory”, and looking at the change dates on bits of the library I suspect that was added after version 2.0.17 so the Cloud Editor doesn’t have it.
And I have even tried an include with the full path as shown in the complier error, which leads to “no such file or directory”.
I am trying to repeat your issue, but it's taking a while to upload the example. I also just looked at the esp32 BLEDevice.h and I see some conditionals in there, maybe that's what's hanging you up. I am just trying the test-ble.ino from the esp32 samples. Will update when something happens.
Using board 'esp32' from platform in folder: /run/arduino/directories-data/packages/esp32/hardware/esp32/2.0.17 Using core 'esp32' from platform in folder: /run/arduino/directories-data/packages/esp32/hardware/esp32/2.0.17
And -
Multiple libraries were found for "BLEDevice.h" Used: /run/arduino/directories-data/internal/ArduinoBLE_1.4.1_679f6bc843142a33 Not used: /run/arduino/directories-data/internal/ESP32_BLE_Arduino_1.0.1_8ea2f3fb01d5c4be Not used: /run/arduino/directories-data/internal/STM32duinoBLE_1.4.0_6de991589f93b7ea Not used: /run/arduino/directories-data/internal/VEGA_ArduinoBLE_1.0.0_b0f76b1d3c4af35c Not used: /run/arduino/directories-data/internal/Seeed_Arduino_rpcBLE_1.0.0_8b4c5e8dbcca40e3 Not used: /run/arduino/directories-data/internal/BLEPeripheral_0.4.0_6be6946591f1a8b6 Not used: /run/arduino/directories-data/packages/esp32/hardware/esp32/2.0.17/libraries/BLE
Using library ArduinoBLE at version 1.4.1 in folder: /run/arduino/directories-data/internal/ArduinoBLE_1.4.1_679f6bc843142a33
So it’s definitely a Cloud Editor compiler fault.
The compiler is using board and core files that are chronically out of date, ignoring the built-in library, and choosing a library file that’s not just out of date but actually been deprecated for at least a year.
So much for -
The Arduino Cloud Editor is hosted online, therefore it is always be up-to-date with the latest features and support for new boards.
Any ideas anyone, or does this need to go to the support email ?
The fact that code written fairly recently in IDE 2.*, using a reasonably “current” version of the built in ESP32 BLE library, will not compile on Cloud Editor because the compiler is choosing an old and deprecated external library and there does not seem to be any way to control it.
What I posted just above is “minimal code to demonstrate the problem”.
EDIT: The cloud editor/compiler is using boards 2.0.17 so ignore that observation.
I don't have enough experience to be sure but I found the following things and some are unusual.
There is a hdr by that name in the core and here is where 'more info' takes us for the ArduinoBLE library note updated this year and ver 1.4.1 MORE INFO
I note your compiler output shows you using a very old esp32 board entry as shown by the following two screen grabs. You have back leveled your esp32 boards by 17 releases. I suspect the compile result will be different if brought up to current 3.3.2
Many many many thanks - you have just short circuited days if not weeks of fruitless discussion about my code, Chris’ code, my hardware, my wiring, my old laptop and version of windows, my browser and it’s cache, and so on. You, an experienced and well respected member of the forum, have the same issue, with just one line of (correctly typed) code, and no hardware connected - QED.
I can’t “physically” highlight on your screen shot, but it is the first fully readable line that shows the problem.
“Using library ArduinoBLE at version 1.4.1 “……….
This is the WRONG library.
I need it to use the built-in library …….”esp/2.0.17/libraries/BLE”
As I put in the thread title, how do I force the compiler to use the built in library ?
Thanks for trying anyway, and thanks again for the suggestion that led to me being able to replicate the issue with minimal code - that’s likely to be extremely useful when I’m struggling though the support system.
The situation is a bit different when using Arduino Cloud Editor because, unlike Arduino IDE, all >8000 libraries of the Arduino Library Manager are preinstalled. So the dependencies environment is a bit more complex. However, the general approach you found still stands. The workaround for the inappropriate choice by the library discovery system is to add an #include directive to your sketch for a header file that is unique to the library you want to use. The difference is that the BLEUUID.h header file I arbitrarily selected as being unique to the "ESP32 BLE Arduino" library that is bundled with the "esp32" boards platform when compared to the "Arduino_BLE" library is not unique when comparing the platform bundled library against the deprecated standalone copy of the library that is in Library Manager.
So we must use a different header file. Fortunately, there is a unique header file named RTOS.h in the platform bundled library. So change this line in your sketch:
to this:
#include <RTOS.h>
then try again. Hopefully everything will work as expected this time.
That is correct for the Library Manager libraries, but this is not a Library Manager library. It is a "platform bundled" library. These libraries are bundled with the Arduino boards platforms that add support for specific boards/microcontrollers to Cloud Editor.
Unlike Library Manager libraries where every version of each library is installed and the user can select which version they want to use when compiling their sketch, there is only one version of each boards platform. So updating the platform can cause breakage of users sketches, which they would only be able to resolve by updating their sketch code to be compatible with the new version of the platform.
There were some very significant breaking changes in the 3.0.0 release of the "esp32" boards platform that came after version 2.0.17. Those breaking changes resulted in many libraries and sketches no longer working. So the Arduino Cloud developers have been hesitant to update the "esp32" boards platform past version 2.0.17. Fortunately the community has been working hard to make the changes needed across the ecosystem to be compatibility with the API of the 3.x "esp32" platform versions, so I think that the eventual update will be less traumatic now than it would have been if the developers had updated the platform immediately after the 3.0.0 release came out.
You were definitely on the right track! You just weren't looking at the correct version of the library. You can see the contents of the platform bundled library here:
and the contents of the standalone library here:
Although it is true that it is the sketch build system that is choosing the inappropriate library, it is not accurate to describe it as "a fault". It is behaving exactly as intended.
In the case where multiple libraries match an #include directive, a sophisticated algorithm is used to determine which of the libraries to use:
This usually does result in the most appropriate library being selected, but in the end it is only a best guess at which of the libraries is most likely to be the one the user wants. There is no way for the system to know that in this specific case the platform bundled library was the correct one to use.
That is because the installed version is out of date. The build system can only use what is installed. You can't blame the fact that an older version happens to be installed on the "compiler".
The build system has no way of knowing the library is deprecated. The only way you know that is that you read it in the readme of the library or something like that. The build system isn't some AI that knows everything on the Internet. It only knows the machine readable information in the library's metadata:
and the list of code files in the library:
Do you see any of that information that would allow the build system to know that the library is deprecated?
Sadly, that results in a stream of compiler errors that I have never seen before, and that I do not understand.
The verbose output will not even copy to the clipboard, but the concise output is (hopefully) below.
Extracting what seems to be just one error -
/run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:21: multiple definition of `mfrDataReceived'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:21: first defined here
It looks almost as if the compiler has stored the function “mfrDataReceived” from VBM.cpp in it’s cache, “….arduino/user-cache/sketches…objs.a(VBM.cpp.o)…..” then tried to compile the function again, from VBM.cpp, and failed as it is already present.
Any ideas please ?
Full “concise” output -
/run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:21: multiple definition of `mfrDataReceived'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:21: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:15: multiple definition of `BIGarray'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:15: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o): in function `AdDataCallback::onResult(BLEAdvertisedDevice)': /run/arduino/sketches/04_00_SeaWitch/VBM.cpp:50: multiple definition of `AdDataCallback::onResult(BLEAdvertisedDevice)'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:50: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:19: multiple definition of `output'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:19: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:100: multiple definition of `inf_TTG'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:100: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o): in function `parseTimeToGo()': /run/arduino/sketches/04_00_SeaWitch/VBM.cpp:223: multiple definition of `parseTimeToGo()'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:223: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:101: multiple definition of `na_batV'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:101: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o): in function `parseBattVolts()': /run/arduino/sketches/04_00_SeaWitch/VBM.cpp:230: multiple definition of `parseBattVolts()'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:230: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:102: multiple definition of `na_aux'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:102: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o): in function `parseAuxVolts()': /run/arduino/sketches/04_00_SeaWitch/VBM.cpp:245: multiple definition of `parseAuxVolts()'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:245: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o): in function `parseMidVolts()': /run/arduino/sketches/04_00_SeaWitch/VBM.cpp:254: multiple definition of `parseMidVolts()'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:254: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o): in function `parseAuxKelvin()': VBM.cpp:(.text._Z14parseAuxKelvinv+0x0): multiple definition of `parseAuxKelvin()'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):04_00_SeaWitch.ino.cpp:(.text._Z14parseAuxKelvinv+0x0): first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:103: multiple definition of `na_batA'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:103: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o): in function `parseBattAmps()': /run/arduino/sketches/04_00_SeaWitch/VBM.cpp:279: multiple definition of `parseBattAmps()'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:279: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:104: multiple definition of `na_Ah'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:104: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o): in function `parseAmpHours()': /run/arduino/sketches/04_00_SeaWitch/VBM.cpp:290: multiple definition of `parseAmpHours()'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:290: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:105: multiple definition of `na_soc'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:105: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o): in function `parseStateOfCharge()': /run/arduino/sketches/04_00_SeaWitch/VBM.cpp:299: multiple definition of `parseStateOfCharge()'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:299: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o): in function `countBitsSet(unsigned int)': /run/arduino/sketches/04_00_SeaWitch/VBM.cpp:340: multiple definition of `countBitsSet(unsigned int)'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:340: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o): in function `reportAlarms(unsigned int)': /run/arduino/sketches/04_00_SeaWitch/VBM.cpp:317: multiple definition of `reportAlarms(unsigned int)'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:317: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:107: multiple definition of `maxduds'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:107: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:107: multiple definition of `dudvals'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:107: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o): in function `reportBMvalues()': /run/arduino/sketches/04_00_SeaWitch/VBM.cpp:171: multiple definition of `reportBMvalues()'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:171: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:18: multiple definition of `cipher'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:18: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:13: multiple definition of `aesDec'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:13: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o): in function `checkForbadArgs()': /run/arduino/sketches/04_00_SeaWitch/VBM.cpp:348: multiple definition of `checkForbadArgs()'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:348: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o): in function `printBIGarray()': /run/arduino/sketches/04_00_SeaWitch/VBM.cpp:360: multiple definition of `printBIGarray()'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:360: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o): in function `printByteArray(unsigned char*)': /run/arduino/sketches/04_00_SeaWitch/VBM.cpp:376: multiple definition of `printByteArray(unsigned char*)'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:376: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:16: multiple definition of `encKey'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:16: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:24: multiple definition of `key_SS'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:24: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:17: multiple definition of `iv'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:17: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o): in function `decryptAesCtr(bool)': /run/arduino/sketches/04_00_SeaWitch/VBM.cpp:67: multiple definition of `decryptAesCtr(bool)'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:67: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o): in function `printBins(unsigned char*)': /run/arduino/sketches/04_00_SeaWitch/VBM.cpp:385: multiple definition of `printBins(unsigned char*)'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:385: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:46: multiple definition of `pBLEScan'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:46: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(VBM.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:12: multiple definition of `aesEnc'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/VBM.cpp:12: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(ZZ.cpp.o):/run/arduino/sketches/04_00_SeaWitch/ZZ.cpp:7: multiple definition of `VERBOSE'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/ZZ.cpp:7: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(ZZ.cpp.o):/run/arduino/sketches/04_00_SeaWitch/ZZ.cpp:8: multiple definition of `FILTERING'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/ZZ.cpp:8: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(ZZ.cpp.o): in function `processSerialCommands()': /run/arduino/sketches/04_00_SeaWitch/ZZ.cpp:14: multiple definition of `processSerialCommands()'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/ZZ.cpp:14: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(ZZ.cpp.o):/run/arduino/sketches/04_00_SeaWitch/ZZ.cpp:11: multiple definition of `line'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/ZZ.cpp:11: first defined here /run/arduino/directories-data/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(ZZ.cpp.o):/run/arduino/sketches/04_00_SeaWitch/ZZ.cpp:10: multiple definition of `dashes'; /var/run/arduino/user-cache/sketches/DC067165F0D974E1A6244A6CB2483BE1/sketch/objs.a(04_00_SeaWitch.ino.cpp.o):/run/arduino/sketches/04_00_SeaWitch/ZZ.cpp:10: first defined here collect2: error: ld returned 1 exit status Multiple libraries were found for "Wire.h" Used: /run/arduino/directories-data/packages/esp32/hardware/esp32/2.0.17/libraries/Wire Not used: /run/arduino/directories-data/internal/FlexWire_1.2.1_1fc5f1d1a14af0e7 Multiple libraries were found for "WebServer.h" Used: /run/arduino/directories-data/packages/esp32/hardware/esp32/2.0.17/libraries/WebServer Not used: /run/arduino/directories-data/internal/HTTPWebServer_1.0.1_e5351dd12e2760ea Not used: /run/arduino/directories-data/internal/Seeed_Arduino_rpcWiFi_1.1.0_a93a349668c69c81 Multiple libraries were found for "INA3221.h" Used: /run/arduino/directories-data/internal/INA3221_0.0.1_4f90cd824362b547 Not used: /run/arduino/directories-data/internal/M5Core2_0.2.0_b8c417594bcb0714 Not used: /run/arduino/directories-data/internal/INA3221_RT_0.4.1_cbb282d8007260c5 Multiple libraries were found for "WiFi.h" Used: /run/arduino/directories-data/packages/esp32/hardware/esp32/2.0.17/libraries/WiFi Not used: /run/arduino/directories-data/internal/NINA-Wi-Fi_1.0.1_8b5f9e1dc71eca55 Not used: /run/arduino/directories-data/internal/BetterWiFiNINA_1.4.1_f1b425a2b2caf410 Not used: /run/arduino/directories-data/internal/indhilib_3.0.5_645ae16078e566f4 Not used: /run/arduino/directories-data/internal/WiFiNINA_1.9.1_7cc9ca1b1de1ea6a Not used: /run/arduino/directories-data/internal/WiFiEspAT_1.5.0_5169a7bcde168205 Not used: /run/arduino/directories-data/internal/Seeed_Arduino_rpcWiFi_1.1.0_a93a349668c69c81 Not used: /run/arduino/directories-data/internal/MicroSui_0.3.1_c5ac565d59978b8e Not used: /run/arduino/directories-data/internal/WiFi_1.2.7_c357666d3257ae8a Not used: /run/arduino/directories-data/internal/VEGA_WiFiNINA_1.0.1_ab2db6059607e9f4 Not used: /run/arduino/directories-data/internal/DA16200_Wi-Fi_Library_for_Arduino_1.1.0_9d156d307009fe30 Multiple libraries were found for "WiFiClientSecure.h" Used: /run/arduino/directories-data/packages/esp32/hardware/esp32/2.0.17/libraries/WiFiClientSecure Not used: /run/arduino/directories-data/internal/Seeed_Arduino_rpcWiFi_1.1.0_a93a349668c69c81 Multiple libraries were found for "OneWireESP32.h" Used: /run/arduino/custom-libraries/esp32-ds18b20 Not used: /run/arduino/directories-data/internal/esp32-ds18b20_2.0.3_2aaf80b9e712d1ed Multiple libraries were found for "TinyGPSPlus.h" Used: /run/arduino/directories-data/internal/TinyGPSPlus_1.0.3_c9a7eae3281cb068 Not used: /run/arduino/directories-data/internal/TinyGPSPlus-ESP32_0.0.2_31aa6c100ec6e698 Not used: /run/arduino/directories-data/internal/TinyGPSPlusPlus_0.0.4_854bffd574647be0
I have commented out the RTOS.h include, and the errors go back to the ones related to using the wrong library. e.g.
In file included from /run/arduino/sketches/04_00_SeaWitch/VBM.cpp:6:
/run/arduino/sketches/04_00_SeaWitch/VB~~
/run/arduino/sketches/04_00_SeaWitch/VBM.h:32:60: error: expected class-name before '{' token
class AdDataCallback : public BLEAdvertisedDeviceCallbacks {
^
/run/arduino/sketches/04_00_SeaWitch/VBM.h:33:17: error: 'BLEAdvertisedDevice' has not been declared
void onResult(BLEAdvertisedDevice advertisedDevice);
^~~~~~~~~~~~~~~~~~~
Interestingly, I note that the complier selects the correct, built-in library, in other cases.
Multiple libraries were found for "WiFi.h"
Used: /run/arduino/directories-data/packages/esp32/hardware/esp32/2.0.17/libraries/WiFi
Not used: /run/arduino/directories-data/internal/MicroSui_0.3.1_c5ac565d59978b8e
Not used: /run/arduino/directories-data/internal/BetterWiFiNINA_1.4.1_f1b425a2b2caf410
Not used: /run/arduino/directories-data/internal/WiFiEspAT_1.5.0_5169a7bcde168205
Not used: /run/arduino/directories-data/internal/WiFi_1.2.7_c357666d3257ae8a
Not used: /run/arduino/directories-data/internal/Seeed_Arduino_rpcWiFi_1.1.0_a93a349668c69c81
Not used: /run/arduino/directories-data/internal/DA16200_Wi-Fi_Library_for_Arduino_1.1.0_9d156d307009fe30
Not used: /run/arduino/directories-data/internal/NINA-Wi-Fi_1.0.1_8b5f9e1dc71eca55
Not used: /run/arduino/directories-data/internal/VEGA_WiFiNINA_1.0.1_ab2db6059607e9f4
Not used: /run/arduino/directories-data/internal/WiFiNINA_1.9.1_7cc9ca1b1de1ea6a
Not used: /run/arduino/directories-data/internal/indhilib_3.0.5_645ae16078e566f4
Multiple libraries were found for "WiFiClientSecure.h"
Used: /run/arduino/directories-data/packages/esp32/hardware/esp32/2.0.17/libraries/WiFiClientSecure
Not used: /run/arduino/directories-data/internal/Seeed_Arduino_rpcWiFi_1.1.0_a93a349668c69c81
Multiple libraries were found for "WebServer.h"
Used: /run/arduino/directories-data/packages/esp32/hardware/esp32/2.0.17/libraries/WebServer
Not used: /run/arduino/directories-data/internal/HTTPWebServer_1.0.1_e5351dd12e2760ea
Not used: /run/arduino/directories-data/internal/Seeed_Arduino_rpcWiFi_1.1.0_a93a349668c69c81
Multiple libraries were found for "Wire.h"
Used: /run/arduino/directories-data/packages/esp32/hardware/esp32/2.0.17/libraries/Wire
Not used: /run/arduino/directories-data/internal/FlexWire_1.2.1_1fc5f1d1a14af0e7
Surely this is the “expected” behavior ?
The complier should default to choose a built-in library if one exists. Then the options for Custom Libraries and Favorite Libraries in the Cloud Editor allow a user to select a different library if they wish.
When the compiler ignores the built-in library and selects a different library, the Custom and Favorite options do not work for built-in libraries, so the user is forced to struggle through the innards of different library code to try to find a “bodge”.
It is a reasonable hypothesis. Please try this experiment:
Open the sketch in Arduino Cloud Editor.
Click the ▼ icon that is located to the right of the sketch name at the top of the Cloud Editor page.
A menu will open.
Select "Rename" from the menu.
The "Rename sketch" dialog will open.
Type a different name in the "Name" field of the dialog. ⓘ It doesn't matter what name you chose, as long as it is different from the previous name.
Click the "RENAME" button at the bottom of the dialog.
Now try compiling the sketch once again. The path of the compilation cache is based on the sketch name, so when you change the sketch name, it will cause a fresh compilation of the sketch code, without reusing the cache from the previous compilation.
If the compilation is successful on the fresh compile, this result would support your hypothesis. Conversely, if the compilation still fails with the same error, this result would disprove your hypothesis.
Please make sure to always put compilation output in code block formatting. That will make it readable. You can do that by the following procedure:
Click the button on the post composer toolbar.
Paste the copied content.
If you want to understand why, study the documentation here:
Although I did not really follow your procedure, it did give me a good hint. I found and fixed the problem, and for future reference - the complier was indeed caching the code, but it was MY FAULT .
The sketch is an amalgam of my work and that of someone else - but I had to extract the other guy’s code from a stand-alone project as he did not write it as a library.
In the process of integrating his code into mine, and at the same time struggling with the compiler selecting the wrong library, I ended up with an “extra” #include VBM.cpp, in the main .ino where it should not have been. This seems to have caused the complier to try to compile VBM.cpp twice. Removing the extra VBM include, but keeping your RTOS one, now lets the sketch compile correctly.
Now I just have to deal with
Sketch uses 1797229 bytes (137%) of program storage space. Maximum is 1310720 bytes. Global variables use 63376 bytes (19%) of dynamic memory, leaving 264304 bytes for local variables. Maximum is 327680 bytes. Sketch too big; see ``https://support.arduino.cc/hc/en-us/articles/360013825179`` for tips on reducing it.
Yes, this is intended, and a very good thing because it means that subsequent compilations of the sketch are much faster due to the build system only needing to compile the components that have changed since the previous compilation. It is only in the hypothetical case where a cached object was being used inappropriately that we would be concerned about the caching.
That will do it! Great work on identifying the cause of the error.
Yes. Think of an #include directive as essentially being replaced by the contents of the referenced file. So you end up with the code from VBM.cpp being compiled when the file that contains the #include directive is compiled, and again when VBM.cpp is compiled.
All .cpp files in the sketch are always compiled, so it never makes sense to have #include directives for .cpp files in the sketch. You only need to use #include for .h files, for the following purposes:
To cause the external library that contains the header file to be compiled
To make the declarations from the header file available in the translation unit.
That is definitely great progress toward a working project!