I get the error 'No such file or directory' when I '#include <ArduinoBLE.h>' in my code. I had a workaround where I reinstalled it, which was very tiresome, but now even that fails.
Is there a permanent solution?
Thanks.
I get the error 'No such file or directory' when I '#include <ArduinoBLE.h>' in my code. I had a workaround where I reinstalled it, which was very tiresome, but now even that fails.
Is there a permanent solution?
Thanks.
Install the library where all the other libraries are. Restart the IDE so it knows the library is there.
Hi @wolfram66. I'm going to ask you to post the full verbose output from a compilation.
This procedure is not intended to solve the problem. The purpose is to gather more information.
Please do this:
#include directive for ArduinoBLE.h.<CODE/> icon on the post composer toolbar.```) to your reply to make sure the error messages are correctly formatted.
In case the output is longer than the forum software will allow to be added to a post, you can instead save it to a .txt file and then attach that file to a reply here:
.txt format.
.txt file you saved from the "Open" dialog.Alternatively, instead of using the "Upload" icon on the post composer toolbar as described in steps (5) - (7) above, you can simply drag and drop the .txt file onto the post composer field to attach it.
I use the library manager, search for "ArduinoBLE," click "install," but the "INSTALLED" message pops up immediately, which says to me it's already there and the IDE just has to find it.
One other 'weird' thing of note is that whenever I compile a BLEDevice sketch I have to delete a 'libraries' folder in my 'Arduino' folder in order to get the sketch to compile, but the folder always pops back up when I hit the compile button.
Also 'weird' is that I have two 'Arduino' folders in 'Documents,' which doesn't make a lot of sense to me because I would prefer things to be more tidy and compact.
The formatting doesn't look right, but here it is:
Arduino: 1.8.12 (Windows 10), Board: "Arduino Nano 33 BLE"
C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\user\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\user\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\user\Documents\Arduino\libraries -fqbn=arduino:mbed_nano:nano33ble -ide-version=10812 -build-path C:\Users\user\AppData\Local\Temp\arduino_build_199644 -warnings=none -build-cache C:\Users\user\AppData\Local\Temp\arduino_cache_254182 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.rp2040tools.path=C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\rp2040tools\1.0.6 -prefs=runtime.tools.rp2040tools-1.0.6.path=C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\rp2040tools\1.0.6 -prefs=runtime.tools.bossac.path=C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.9.1-arduino2 -prefs=runtime.tools.bossac-1.9.1-arduino2.path=C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.9.1-arduino2 -prefs=runtime.tools.dfu-util.path=C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\dfu-util\0.10.0-arduino1 -prefs=runtime.tools.dfu-util-0.10.0-arduino1.path=C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\dfu-util\0.10.0-arduino1 -prefs=runtime.tools.openocd.path=C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.11.0-arduino2 -prefs=runtime.tools.openocd-0.11.0-arduino2.path=C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.11.0-arduino2 -prefs=runtime.tools.arm-none-eabi-gcc.path=C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4 -prefs=runtime.tools.arm-none-eabi-gcc-7-2017q4.path=C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4 -verbose C:\Users\user\Documents\Arduino\sketch_may09a\sketch_may09a.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\user\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\user\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\user\Documents\Arduino\libraries -fqbn=arduino:mbed_nano:nano33ble -ide-version=10812 -build-path C:\Users\user\AppData\Local\Temp\arduino_build_199644 -warnings=none -build-cache C:\Users\user\AppData\Local\Temp\arduino_cache_254182 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.rp2040tools.path=C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\rp2040tools\1.0.6 -prefs=runtime.tools.rp2040tools-1.0.6.path=C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\rp2040tools\1.0.6 -prefs=runtime.tools.bossac.path=C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.9.1-arduino2 -prefs=runtime.tools.bossac-1.9.1-arduino2.path=C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.9.1-arduino2 -prefs=runtime.tools.dfu-util.path=C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\dfu-util\0.10.0-arduino1 -prefs=runtime.tools.dfu-util-0.10.0-arduino1.path=C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\dfu-util\0.10.0-arduino1 -prefs=runtime.tools.openocd.path=C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.11.0-arduino2 -prefs=runtime.tools.openocd-0.11.0-arduino2.path=C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.11.0-arduino2 -prefs=runtime.tools.arm-none-eabi-gcc.path=C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4 -prefs=runtime.tools.arm-none-eabi-gcc-7-2017q4.path=C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4 -verbose C:\Users\user\Documents\Arduino\sketch_may09a\sketch_may09a.ino
Using board 'nano33ble' from platform in folder: C:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\4.0.2
Using core 'arduino' from platform in folder: C:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\4.0.2
Detecting libraries used...
"C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -w -g3 -nostdlib "@C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\variants\\ARDUINO_NANO33BLE/defines.txt" "@C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\variants\\ARDUINO_NANO33BLE/cxxflags.txt" -DARDUINO_ARCH_NRF52840 -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -w -x c++ -E -CC -DARDUINO=10812 -DARDUINO_ARDUINO_NANO33BLE -DARDUINO_ARCH_MBED_NANO -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=0 "-IC:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\cores\\arduino" "-IC:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\variants\\ARDUINO_NANO33BLE" "-IC:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\cores\\arduino/api/deprecated-avr-comp" "-iprefixC:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\cores\\arduino" "@C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\4.0.2\\variants\\ARDUINO_NANO33BLE/includes.txt" "C:\\Users\\user\\AppData\\Local\\Temp\\arduino_build_199644\\sketch\\sketch_may09a.ino.cpp" -o nul
Alternatives for ArduinoBLE.h: []
ResolveLibrary(ArduinoBLE.h)sketch_may09a:2:10: fatal error: ArduinoBLE.h: No such file or directory
-> candidates: [] #include <ArduinoBLE.h>
^~~~~~~~~~~~~~
compilation terminated.
exit status 1
ArduinoBLE.h: No such file or directory=
I attempted to solve the above-mentioned problem by downloading the new IDE and some libraries, but the <BLEDevice.h> issue persists. I read a post that said to list your includes like so:
#include <BLE2902.h>
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>
which nonetheless produced the following error:
Multiple libraries were found for "BLE2902.h"
Used: C:\Users\user\Desktop\Documents\Arduino\libraries\ESP32_BLE_Arduino
Not used: C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.16\libraries\BLE
Using library ESP32 BLE Arduino at version 1.0.1 in folder: C:\Users\user\Desktop\Documents\Arduino\libraries\ESP32_BLE_Arduino
exit status 1
Compilation error: exit status 1
If you could help me solve my current problem, I would be much obliged.
Thanks!
Board: "Arduino Nano 33 BLE"
You should not be including esp32 libraries in your code. For the Nano 33 BLE board all you should need is
#include <ArduinoBLE.h>
I attempted to solve the above-mentioned problem by downloading the new IDE and some libraries
Do you still see the error about not finding the ArduinoBLE.h library?
I'm using two boards and two libraries, sorry for the confusion.
The problem is with the AI Thinker Esp32-cam board where I've included
#include <BLEDevice.h>
and I'm getting the error
Multiple libraries were found for "BLEDevice.h"
Used: C:\Users\user\Desktop\Documents\Arduino\libraries\ArduinoBLE
Not used: C:\Users\user\Desktop\Documents\Arduino\libraries\ESP32_BLE_Arduino
Not used: C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.16\libraries\BLE
Using library ArduinoBLE at version 1.3.6 in folder: C:\Users\user\Desktop\Documents\Arduino\libraries\ArduinoBLE
exit status 1
Compilation error: 'BLEAdvertisedDevice' does not name a type
Very strange that it would use the ArduinoBLE library!
Thanks.
I can see from the second output that Arduino IDE is able to recognize the installation of the "ArduinoBLE" library, but it is not able to find the ArduinoBLE.h header. It might be that that file went missing from the library for some reason. If so, the problem might be solved by uninstalling and then reinstalling the library. Please try this:
Delete the folder at the following path on your hard drive:
C:\Users\user\Desktop\Documents\Arduino\libraries\ArduinoBLE
Please be careful when deleting things from your computer. When in doubt, back up!
Select Sketch > Include Library > Manage Libraries... from the Arduino IDE menus.
The "Library Manager" dialog will open.
Wait for the update to finish, as indicated by the progress bar at the bottom of the "Library Manager" dialog.
Type ArduinoBLE in the "Filter your search..." field.
Press the Enter key.
Scroll down through the list of libraries until you see the "ArduinoBLE" entry. Click on it.
A menu and button will appear at the bottom of the entry.
Click the "Install" button in the "ArduinoBLE" entry.
You may now get a dialog asking:
Would you like to install also all the missing dependencies?
If so, click the "Install all" button.
Wait for the installation to finish.
Click the "Close" button in the "Library Manager" dialog.
The "Library Manager" dialog will close.
Now try compiling the sketch with the #include directive for ArduinoBLE.h again. Does the error still occur?
This is probably the explanation for why you previously found the need to repeatedly reinstall the "ArduinoBLE" library. The Arduino IDE Library Manager installs libraries to that folder, so if you delete the folder then you delete all the libraries you installed.
Is the folder empty when it "pops back up"?
Since this folder is fundamental to its operation, Arduino IDE does automatically generate this folder if it doesn't already exist. However, it won't automatically install libraries to that folder. That only happens when you perform an installation via Library manager or the "Add .ZIP Library..." feature.
Arduino IDE has a "library discovery" system. For each #include directive in the program being compiled, the IDE first checks to see if the file is present in the the compiler's "search path". If not, it then searches through the root source folder of each of the installed libraries to look for a file of that name.
Sometimes multiple libraries contain a file matching the #include directive. In this case, Arduino IDE must decide which of the libraries to use. It has a sophisticated algorithm for picking the best library so it usually makes the right decision, but not always.
This is a case where Arduino IDE made the wrong decision when discovering the library for the #include <BLEDevice.h> directive. A file of that name is present in the "ArduinoBLE" library, the "ESP32 BLE Arduino" library you installed via Library Manager, and the "ESP32 BLE Arduino" library that is bundled with the "esp32" boards platform installation. The IDE chose to use the "ArduinoBLE" library, but from what I can tell, your sketch is meant to use the "ESP32 BLE Arduino" library that is bundled with the "esp32" boards platform.
You found one workaround for this problem, which was to uninstall the other libraries so that Arduino IDE didn't have the option of choosing it. That is reasonable when you don't need those other libraries. You can use this technique to eliminate the "ESP32 BLE Arduino" library you installed via Library Manager. That is an outdated version of the same library that is now bundled with the "esp32" boards platform, so the copy of the library you installed via Library Manager is unnecessary and will only cause problems. So delete the folder at the following path on your hard drive:
C:\Users\user\Desktop\Documents\Arduino\libraries\ESP32_BLE_Arduino
So now we are left with only two candidates for the #include directive. It is not reasonable to delete the "ArduinoBLE" library since you need that library for your Nano 33 BLE sketch. So we will employ a different technique to influence Arduino IDE to choose the the "ESP32 BLE Arduino" library that is bundled with the "esp32" boards platform:
As I mentioned before, files from the include search path are always given priority by the library discovery system. Once a library is "discovered", its path is added to the include search path. So if we can cause the "ESP32 BLE Arduino" library to be discovered before Arduino IDE does discovery for the ambiguous BLEDevice.h file, then it not discover the "ArduinoBLE" library. This is accomplished by placing an #include directive for a file unique to the "ESP32 BLE Arduino" library above the ambiguous #include directive.
I will arbitrarily choose the file BLEUUID.h, which is present in the "ESP32 BLE Arduino" library, but not in the "ArduinoBLE" library. Simply add an #include directive for that file above the #include directive for BLEDevice.h in your sketch.
So change this part of your sketch:
#include <BLEDevice.h>
to this:
#include <BLEUUID.h>
#include <BLEDevice.h>
Now try compiling the sketch for the ESP32 board again. Hopefully this time the "'BLEAdvertisedDevice' does not name a type" error will not occur and everything will work as expected.
While ArduinoBLE.h is valid for the eps32, In my experience it is best to use the ESP32 libraries and their syntax for boards with that mcu, and to use ArduinoBLE.h for boards with different processors.
My solution to the library conflicts is to change the valid architecture specification for ArduinoBLE.h.
Find where the library is installed on your computer, and change the library properties file for ArduinoBLE.h
//architectures=samd,megaavr,mbed,apollo3,mbed_nano,mbed_portenta,mbed_nicla,esp32,mbed_giga,renesas,renesas_portenta,mbed_opta,renesas_uno
architectures=samd,megaavr,mbed,apollo3,mbed_nano,mbed_portenta,mbed_nicla,mbed_giga,renesas,renesas_portenta,mbed_opta,renesas_uno
includes=ArduinoBLE.h
This must have worked because BLEDevice.h is no longer in the libraries folder and I even know why I had to do all the adding and deleting of libraries.
Thanks for all your help, guys.
You are welcome. I'm glad it is working now.
Regards,
Per
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.