ESP32-S3 Bluetooth projects now won't compile

The standard project templates were OK a week ago or more, I’ve come back to them at the end of last week and can’t get any of my development stages working, or the standard ones straight from the examples menu.

Is there a recent update that’s faulty?

I’ve just uninstalled Arduino ESP32 Boards, as I am not using those. I’m using esp32 v3.32. The board is either - ESP32S3 Dev Module, or ESP32-S3-Box, bought a couple of weeks ago

This is the first error showing and happens with either my own previously working projects or a fresh Example:

In file included from xxxxxx\BLE_3.ino:23:
xxxxxxxxxxxx\BLE_3/BLEServer.h:12:10: fatal error: esp_gatts_api.h: No such file or directory
12 | #include <esp_gatts_api.h>
|          ^~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: esp_gatts_api.h: No such file or directory

A first step would be to downgrade the platform to an earlier 3.x version and try again.

If that does not help you can try to downgrade the platform to the latest 2.x version.

Please post one of the examples that does not work; I tried BLE5_periodic_sync example but that resulted in different errors (#error "NimBLE does not support periodic sync yet. Try using Bluedroid.") to start with.

I'm not and ESP32 user.

This is an example BLE project, previously working and not edited in any way. Board set as ESP32-Box.

/*
  Video: https://www.youtube.com/watch?v=oCMOYS71NIU
  Based on Neil Kolban example for IDF: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleNotify.cpp
  Ported to Arduino ESP32 by Evandro Copercini


  Create a BLE server that, once we receive a connection, will send periodic notifications.
  The service advertises itself as: 6E400001-B5A3-F393-E0A9-E50E24DCCA9E
  Has a characteristic of: 6E400002-B5A3-F393-E0A9-E50E24DCCA9E - used for receiving data with "WRITE"
  Has a characteristic of: 6E400003-B5A3-F393-E0A9-E50E24DCCA9E - used to send data with  "NOTIFY"

  The design of creating the BLE server is:
  1. Create a BLE Server
  2. Create a BLE Service
  3. Create a BLE Characteristic on the Service
  4. Create a BLE Descriptor on the characteristic
  5. Start the service.
  6. Start advertising.


  In this example rxValue is the data received (only accessible inside that function).
  And txValue is the data to be sent, in this example just a byte incremented every second.
*/

#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
#include <BLE2902.h>

BLEServer *pServer = NULL;
BLECharacteristic *pTxCharacteristic;
bool deviceConnected = false;
bool oldDeviceConnected = false;
uint8_t txValue = 0;

// See the following for generating UUIDs:
// https://www.uuidgenerator.net/
#define SERVICE_UUID "6E400001-B5A3-F393-E0A9-E50E24DCCA9E"  // UART service UUID
#define CHARACTERISTIC_UUID_RX "6E400002-B5A3-F393-E0A9-E50E24DCCA9E"
#define CHARACTERISTIC_UUID_TX "6E400003-B5A3-F393-E0A9-E50E24DCCA9E"

class MyServerCallbacks : public BLEServerCallbacks {
  void onConnect(BLEServer *pServer) {
    deviceConnected = true;
    Serial.println("Device connected");
  };

  void onDisconnect(BLEServer *pServer) {
    deviceConnected = false;
    Serial.println("Device disconnected");
  }
};


class MyCallbacks : public BLECharacteristicCallbacks {
  void onWrite(BLECharacteristic *pCharacteristic) {
    String rxValue = pCharacteristic->getValue();

    if (rxValue.length() > 0) {
      Serial.println("*********");
      Serial.print("Received Value: ");
      for (int i = 0; i < rxValue.length(); i++) {
        Serial.print(rxValue[i]);
      }

      Serial.println();
      Serial.println("*********");
    }
  }
};


void setup() {
  Serial.begin(115200);

  // Create the BLE Device
  BLEDevice::init("UART Service");

  // Create the BLE Server
  pServer = BLEDevice::createServer();
  pServer->setCallbacks(new MyServerCallbacks());

  // Create the BLE Service
  BLEService *pService = pServer->createService(SERVICE_UUID);

  // Create a BLE Characteristic
  pTxCharacteristic = pService->createCharacteristic(CHARACTERISTIC_UUID_TX, BLECharacteristic::PROPERTY_NOTIFY);

  // Descriptor 2902 is not required when using NimBLE as it is automatically added based on the characteristic properties
  pTxCharacteristic->addDescriptor(new BLE2902());

  BLECharacteristic *pRxCharacteristic = pService->createCharacteristic(CHARACTERISTIC_UUID_RX, BLECharacteristic::PROPERTY_WRITE);

  pRxCharacteristic->setCallbacks(new MyCallbacks());

  // Start the service
  pService->start();

  // Start advertising
  pServer->getAdvertising()->start();
  Serial.println("Waiting a client connection to notify...");
}


void loop() {
  if (deviceConnected) {
    Serial.print("Notifying Value: ");
    Serial.println(txValue);
    pTxCharacteristic->setValue(&txValue, 1);
    pTxCharacteristic->notify();
    txValue++;
    delay(1000);  // Notifying every 1 second
  }

  // disconnecting
  if (!deviceConnected && oldDeviceConnected) {
    delay(500);                   // give the bluetooth stack the chance to get things ready
    pServer->startAdvertising();  // restart advertising
    Serial.println("Started advertising again...");
    oldDeviceConnected = false;
  }
  // connecting
  if (deviceConnected && !oldDeviceConnected) {
    // do stuff here on connecting
    oldDeviceConnected = true;
  }
}

Thanks; your code compiles on my system. From the first few lines yoy can see that I used the esp32-s3-box and package 3.3.2.

FQBN: esp32:esp32:esp32s3box
Using board 'esp32s3box' from platform in folder: C:\Users\bugge\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2
Using core 'esp32' from platform in folder: C:\Users\bugge\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2

cmd /c if exist "C:\\Users\\bugge\\AppData\\Local\\Temp\\.arduinoIDE-unsaved2025927-15808-6d1xe6.2fyrs\\sketch_oct27c\\partitions.csv" COPY /y "C:\\Users\\bugge\\AppData\\Local\\Temp\\.arduinoIDE-unsaved2025927-15808-6d1xe6.2fyrs\\sketch_oct27c\\partitions.csv" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\partitions.csv"
cmd /c if not exist "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\partitions.csv" if exist "C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.3.2\\variants\\esp32s3box\\partitions.csv" COPY "C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.3.2\\variants\\esp32s3box\\partitions.csv" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\partitions.csv"
cmd /c if not exist "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\partitions.csv" COPY "C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.3.2\\tools\\partitions\\app3M_fat9M_16MB.csv" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\partitions.csv"
        1 file(s) copied.
cmd /c IF EXIST "C:\\Users\\bugge\\AppData\\Local\\Temp\\.arduinoIDE-unsaved2025927-15808-6d1xe6.2fyrs\\sketch_oct27c\\bootloader.bin" ( COPY /y "C:\\Users\\bugge\\AppData\\Local\\Temp\\.arduinoIDE-unsaved2025927-15808-6d1xe6.2fyrs\\sketch_oct27c\\bootloader.bin" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\sketch_oct27c.ino.bootloader.bin" ) ELSE ( IF EXIST "C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.3.2\\variants\\esp32s3box\\bootloader.bin" ( COPY "C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.3.2\\variants\\esp32s3box\\bootloader.bin" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\sketch_oct27c.ino.bootloader.bin" ) ELSE ( "C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esptool_py\\5.1.0\\esptool.exe" --chip esp32s3 elf2image --flash-mode dio --flash-freq 80m --flash-size 16MB -o "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\sketch_oct27c.ino.bootloader.bin" "C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp32-arduino-libs\\idf-release_v5.5-07e9bf49-v1\\esp32s3\\bin\\bootloader_qio_80m.elf" ) )
esptool v5.1.0
Creating ESP32S3 image...
Merged 2 ELF sections.
Successfully created ESP32S3 image.
cmd /c if exist "C:\\Users\\bugge\\AppData\\Local\\Temp\\.arduinoIDE-unsaved2025927-15808-6d1xe6.2fyrs\\sketch_oct27c\\build_opt.h" COPY /y "C:\\Users\\bugge\\AppData\\Local\\Temp\\.arduinoIDE-unsaved2025927-15808-6d1xe6.2fyrs\\sketch_oct27c\\build_opt.h" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\build_opt.h"
cmd /c if not exist "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\build_opt.h" type nul > "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\build_opt.h"
cmd /c type nul > "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93/file_opts"
cmd /c COPY /y "C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp32-arduino-libs\\idf-release_v5.5-07e9bf49-v1\\esp32s3\\sdkconfig" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\sdkconfig"
        1 file(s) copied.
Detecting libraries used...
C:\Users\bugge\AppData\Local\Arduino15\packages\esp32\tools\esp-x32\2507/bin/xtensa-esp32s3-elf-g++ -c @C:\Users\bugge\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/flags/cpp_flags -w -Os -Werror=return-type -w -x c++ -E -CC -DF_CPU=240000000L -DARDUINO=10607 -DARDUINO_ESP32_S3_BOX -DARDUINO_ARCH_ESP32 -DARDUINO_BOARD="ESP32_S3_BOX" -DARDUINO_VARIANT="esp32s3box" -DARDUINO_PARTITION_app3M_fat9M_16MB -DARDUINO_HOST_OS="windows" -DARDUINO_FQBN="esp32:esp32:esp32s3box:USBMode=hwcdc,MSCOnBoot=default,DFUOnBoot=default,PartitionScheme=app3M_fat9M_16MB,DebugLevel=none,EraseFlash=none" -DESP32=ESP32 -DCORE_DEBUG_LEVEL=0 -DARDUINO_RUNNING_CORE=1 -DARDUINO_EVENT_RUNNING_CORE=1 -DBOARD_HAS_PSRAM -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=0 @C:\Users\bugge\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/flags/defines -IC:\Users\bugge\AppData\Local\Temp\.arduinoIDE-unsaved2025927-15808-6d1xe6.2fyrs\sketch_oct27c -iprefix C:\Users\bugge\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/include/ @C:\Users\bugge\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/flags/includes -IC:\Users\bugge\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/qio_opi/include -IC:\Users\bugge\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\cores\esp32 -IC:\Users\bugge\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\variants\esp32s3box @C:\Users\bugge\AppData\Local\arduino\sketches\15137BD56F5BA6287A708938990E1A93/build_opt.h @C:\Users\bugge\AppData\Local\arduino\sketches\15137BD56F5BA6287A708938990E1A93/file_opts C:\Users\bugge\AppData\Local\arduino\sketches\15137BD56F5BA6287A708938990E1A93\sketch\sketch_oct27c.ino.cpp -o nul
Alternatives for BLEDevice.h: [BLE@3.3.2]
ResolveLibrary(BLEDevice.h)
  -> candidates: [BLE@3.3.2]
...
...
C:\Users\bugge\AppData\Local\Arduino15\packages\esp32\tools\esp-x32\2507/bin/xtensa-esp32s3-elf-g++ -c @C:\Users\bugge\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/flags/cpp_flags -w -Os -Werror=return-type -w -x c++ -E -CC -DF_CPU=240000000L -DARDUINO=10607 -DARDUINO_ESP32_S3_BOX -DARDUINO_ARCH_ESP32 -DARDUINO_BOARD="ESP32_S3_BOX" -DARDUINO_VARIANT="esp32s3box" -DARDUINO_PARTITION_app3M_fat9M_16MB -DARDUINO_HOST_OS="windows" -DARDUINO_FQBN="esp32:esp32:esp32s3box:USBMode=hwcdc,MSCOnBoot=default,DFUOnBoot=default,PartitionScheme=app3M_fat9M_16MB,DebugLevel=none,EraseFlash=none" -DESP32=ESP32 -DCORE_DEBUG_LEVEL=0 -DARDUINO_RUNNING_CORE=1 -DARDUINO_EVENT_RUNNING_CORE=1 -DBOARD_HAS_PSRAM -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=0 @C:\Users\bugge\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/flags/defines -IC:\Users\bugge\AppData\Local\Temp\.arduinoIDE-unsaved2025927-15808-6d1xe6.2fyrs\sketch_oct27c -iprefix C:\Users\bugge\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/include/ @C:\Users\bugge\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/flags/includes -IC:\Users\bugge\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/qio_opi/include -IC:\Users\bugge\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\cores\esp32 -IC:\Users\bugge\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\variants\esp32s3box -IC:\Users\bugge\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src @C:\Users\bugge\AppData\Local\arduino\sketches\15137BD56F5BA6287A708938990E1A93/build_opt.h @C:\Users\bugge\AppData\Local\arduino\sketches\15137BD56F5BA6287A708938990E1A93/file_opts C:\Users\bugge\AppData\Local\arduino\sketches\15137BD56F5BA6287A708938990E1A93\sketch\sketch_oct27c.ino.cpp -o C:\Users\bugge\AppData\Local\Temp\2893666611\sketch_merged.cpp
C:\Users\bugge\AppData\Local\Arduino15\packages\builtin\tools\ctags\5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives C:\Users\bugge\AppData\Local\Temp\2893666611\sketch_merged.cpp

Compiling sketch...
"C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp-x32\\2507/bin/xtensa-esp32s3-elf-g++" -MMD -c "@C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp32-arduino-libs\\idf-release_v5.5-07e9bf49-v1\\esp32s3/flags/cpp_flags" -Wall -Wextra -Os -Werror=return-type -DF_CPU=240000000L -DARDUINO=10607 -DARDUINO_ESP32_S3_BOX -DARDUINO_ARCH_ESP32 "-DARDUINO_BOARD=\"ESP32_S3_BOX\"" "-DARDUINO_VARIANT=\"esp32s3box\"" -DARDUINO_PARTITION_app3M_fat9M_16MB "-DARDUINO_HOST_OS=\"windows\"" "-DARDUINO_FQBN=\"esp32:esp32:esp32s3box:USBMode=hwcdc,MSCOnBoot=default,DFUOnBoot=default,PartitionScheme=app3M_fat9M_16MB,DebugLevel=none,EraseFlash=none\"" -DESP32=ESP32 -DCORE_DEBUG_LEVEL=0 -DARDUINO_RUNNING_CORE=1 -DARDUINO_EVENT_RUNNING_CORE=1 -DBOARD_HAS_PSRAM -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=0 "@C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp32-arduino-libs\\idf-release_v5.5-07e9bf49-v1\\esp32s3/flags/defines" "-IC:\\Users\\bugge\\AppData\\Local\\Temp\\.arduinoIDE-unsaved2025927-15808-6d1xe6.2fyrs\\sketch_oct27c" -iprefix "C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp32-arduino-libs\\idf-release_v5.5-07e9bf49-v1\\esp32s3/include/" "@C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp32-arduino-libs\\idf-release_v5.5-07e9bf49-v1\\esp32s3/flags/includes" "-IC:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp32-arduino-libs\\idf-release_v5.5-07e9bf49-v1\\esp32s3/qio_opi/include" "-IC:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.3.2\\cores\\esp32" "-IC:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.3.2\\variants\\esp32s3box" "-IC:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.3.2\\libraries\\BLE\\src" "@C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93/build_opt.h" "@C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93/file_opts" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\sketch\\sketch_oct27c.ino.cpp" -o "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\sketch\\sketch_oct27c.ino.cpp.o"
C:\Users\bugge\AppData\Local\Temp\.arduinoIDE-unsaved2025927-15808-6d1xe6.2fyrs\sketch_oct27c\sketch_oct27c.ino: In function 'void setup()':
C:\Users\bugge\AppData\Local\Temp\.arduinoIDE-unsaved2025927-15808-6d1xe6.2fyrs\sketch_oct27c\sketch_oct27c.ino:143:40: warning: 'BLE2902' is deprecated: NimBLE does not support manually adding 2902 descriptors as they are automatically added when the characteristic has notifications or indications enabled. Get/Set the notifications/indications properties of the characteristic instead. This class will be removed in a future version. [-Wdeprecated-declarations]
  143 |   pTxCharacteristic->addDescriptor(new BLE2902());
      |                                        ^~~~~~~
In file included from C:\Users\bugge\AppData\Local\Temp\.arduinoIDE-unsaved2025927-15808-6d1xe6.2fyrs\sketch_oct27c\sketch_oct27c.ino:7:
C:\Users\bugge\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLE2902.h:45:53: note: declared here
   45 | This class will be removed in a future version.")]] BLE2902 : public BLEDescriptor {
      |                                                     ^~~~~~~
Compiling libraries...
Compiling library "BLE"
...
...
Compiling core...
cmd /c echo -DARDUINO_CORE_BUILD > "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93/file_opts"
...
...
In file included from C:\Users\bugge\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/include/hal/esp32s3/include/hal/spi_flash_ll.h:17,
                 from C:\Users\bugge\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\cores\esp32\Esp.cpp:41:
C:\Users\bugge\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/include/hal/esp32s3/include/hal/gpspi_flash_ll.h: In function 'void gpspi_flash_ll_read_phase(spi_dev_t*)':
C:\Users\bugge\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/include/hal/esp32s3/include/hal/gpspi_flash_ll.h:191:5: warning: missing initializer for member 'spi_dev_s::<unnamed union>::<unnamed struct>::doutdin' [-Wmissing-field-initializers]
  191 |     };
      |     ^
...
...
C:\Users\bugge\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/include/hal/esp32s3/include/hal/gpspi_flash_ll.h:309:5: warning: missing initializer for member 'spi_dev_s::<unnamed union>::<unnamed struct>::reserved16' [-Wmissing-field-initializers]
  309 |     };
      |     ^
C:\Users\bugge\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/include/hal/esp32s3/include/hal/gpspi_flash_ll.h:309:5: warning: missing initializer for member 'spi_dev_s::<unnamed union>::<unnamed struct>::mst_rempty_err_end_en' [-Wmissing-field-initializers]
In file included from C:\Users\bugge\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/include/hal/esp32s3/include/hal/spi_flash_ll.h:18:
C:\Users\bugge\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/include/hal/esp32s3/include/hal/spimem_flash_ll.h: In function 'void spimem_flash_ll_read_phase(spi_mem_dev_t*)':
C:\Users\bugge\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/include/hal/esp32s3/include/hal/spimem_flash_ll.h:425:5: warning: missing initializer for member 'spi_mem_dev_s::<unnamed union>::<unnamed struct>::reserved0' [-Wmissing-field-initializers]
  425 |     };
      |     ^
...
...
Archiving built core (caching) in: C:\Users\bugge\AppData\Local\arduino\cores\ca666a5a658818364f003fb40955ad11\core.a
cmd /c type nul > "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93/file_opts"
Linking everything together...
"C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp-x32\\2507/bin/xtensa-esp32s3-elf-g++" "-Wl,--Map=C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93/sketch_oct27c.ino.map" "-LC:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp32-arduino-libs\\idf-release_v5.5-07e9bf49-v1\\esp32s3/lib" "-LC:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp32-arduino-libs\\idf-release_v5.5-07e9bf49-v1\\esp32s3/ld" "-LC:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp32-arduino-libs\\idf-release_v5.5-07e9bf49-v1\\esp32s3/qio_opi" -Wl,--wrap=esp_panic_handler "@C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp32-arduino-libs\\idf-release_v5.5-07e9bf49-v1\\esp32s3/flags/ld_flags" "@C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp32-arduino-libs\\idf-release_v5.5-07e9bf49-v1\\esp32s3/flags/ld_scripts" -Wl,--start-group "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\sketch\\sketch_oct27c.ino.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLE2901.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLE2902.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLE2904.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLEAddress.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLEAdvertisedDevice.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLEAdvertising.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLEBeacon.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLECharacteristic.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLECharacteristicMap.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLEClient.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLEDescriptor.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLEDescriptorMap.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLEDevice.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLEEddystoneTLM.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLEEddystoneURL.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLEExceptions.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLEHIDDevice.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLERemoteCharacteristic.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLERemoteDescriptor.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLERemoteService.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLEScan.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLESecurity.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLEServer.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLEService.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLEServiceMap.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLEUUID.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLEUtils.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\BLEValue.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\FreeRTOS.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\BLE\\GeneralUtils.cpp.o" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\core\\core.a" "@C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp32-arduino-libs\\idf-release_v5.5-07e9bf49-v1\\esp32s3/flags/ld_libs" -Wl,--end-group -Wl,-EL -o "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93/sketch_oct27c.ino.elf"
"C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esptool_py\\5.1.0/esptool.exe" --chip esp32s3 elf2image --flash-mode dio --flash-freq 80m --flash-size 16MB --elf-sha256-offset 0xb0 -o "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93/sketch_oct27c.ino.bin" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93/sketch_oct27c.ino.elf"
esptool v5.1.0
Creating ESP32S3 image...
Merged 2 ELF sections.
Successfully created ESP32S3 image.
"C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.3.2\\tools\\gen_esp32part.exe" -q "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93/partitions.csv" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93/sketch_oct27c.ino.partitions.bin"
cmd /c if exist "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\Insights" "C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.3.2\\tools\\gen_insights_package.exe" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93" sketch_oct27c.ino "C:\\Users\\bugge\\AppData\\Local\\Temp\\.arduinoIDE-unsaved2025927-15808-6d1xe6.2fyrs\\sketch_oct27c"
cmd /c if exist "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\libraries\\ESP_SR" if exist "C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp32-arduino-libs\\idf-release_v5.5-07e9bf49-v1\\esp32s3\\esp_sr\\srmodels.bin" COPY /y "C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp32-arduino-libs\\idf-release_v5.5-07e9bf49-v1\\esp32s3\\esp_sr\\srmodels.bin" "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93\\srmodels.bin"
"C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esptool_py\\5.1.0/esptool.exe" --chip esp32s3 merge-bin -o "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93/sketch_oct27c.ino.merged.bin" --pad-to-size 16MB --flash-mode keep --flash-freq keep --flash-size keep 0x0 "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93/sketch_oct27c.ino.bootloader.bin" 0x8000 "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93/sketch_oct27c.ino.partitions.bin" 0xe000 "C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.3.2/tools/partitions/boot_app0.bin" 0x10000 "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93/sketch_oct27c.ino.bin"
esptool v5.1.0
Wrote 0x1000000 bytes to file 'C:\Users\bugge\AppData\Local\arduino\sketches\15137BD56F5BA6287A708938990E1A93/sketch_oct27c.ino.merged.bin', ready to flash to offset 0x0.
Using library BLE at version 3.3.2 in folder: C:\Users\bugge\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE 
"C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp-x32\\2507/bin/xtensa-esp32s3-elf-size" -A "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\15137BD56F5BA6287A708938990E1A93/sketch_oct27c.ino.elf"
Sketch uses 602755 bytes (19%) of program storage space. Maximum is 3145728 bytes.
Global variables use 32860 bytes (10%) of dynamic memory, leaving 294820 bytes for local variables. Maximum is 327680 bytes.

There are a few warnings; I'll leave it up to you to sort those out.

I suggest that you downgrade to an earlier version (e.g. 3.3.1), test and next upgrade to 3.3.2; you might have a corrupt installation.

Thank you, I will check again today if possible

I uninstalled ESP32, reinstalled version 3.31, still no joy.

I went back to 3.32 and still not.

I installed the latest Arduino IDE, mine was 2.3.5 and now is 2.3.6. But immediately again

\Documents\Arduino\libraries\ESP32_BLE_Arduino\src/BLEUtils.h:12:10: fatal error: esp_gattc_api.h: No such file or directory

The file esp_gattc_api.h is part of IDF, but if the examples given in Arduino IDE are supposed to work with Arduino IDE then they should. If they need the IDF installation this should show up in the dependencies notification.

Having said that, I do have ESP IDF installed… PC major problems maybe.

Hi @chrisgadg. I believe the problem is that you have installed the obsolete "ESP32 BLE Arduino" library via the Arduino IDE Library Manager. That library is now bundled with the "esp32" boards platform.

The copy bundled with the platform is actively maintained for compatibility with the associated platform version. Conversely, the copy of the library in Library Manager is no longer maintained, and so is not compatible with the recent versions of the "esp32" boards platform.

So the solution will be to uninstall the copy of the library installed by Library Manager. That will allow the copy of the library bundled with the platform to be used. I'll provide instructions you can follow to do that:

  1. Select Sketch > Include Library > Manage Libraries... from the Arduino IDE menus to open the "Library Manager" view in the left side panel.
  2. Type ESP32 BLE Arduino in the "Filter your search..." field.
  3. Find the "ESP32 BLE Arduino" entry in the list of search results.
  4. Hover the mouse pointer over the "ESP32 BLE Arduino" entry.
  5. You will see a ●●● icon appear near the top right corner of the library entry. Click on that icon.
    A context menu will open.
  6. Select "Remove" from the menu.
    An "Uninstall" dialog will open.
  7. Click the "YES" button in the "Uninstall" dialog to confirm that you want to uninstall the library.
    The dialog will close.
  8. Wait for the uninstall process to finish, as indicated by a notification at the bottom right corner of the Arduino IDE window:

    ⓘ Successfully uninstalled library ...

Now try compiling your sketch again. Hopefully this time it will be successful.

Thanks, I have tried… but more errors. The examples listed for any specific device look like guesswork. But I did get all of them working as far as they are intended to work.

After uninstalling ESP32 BLE Arduino and restarting the IDE:

In file included from C:\Users\chris.gray\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLECharacteristic.h:27,
from C:\Users\chris.gray\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLEService.h:24,
from C:\Users\chris.gray\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLEClient.h:28,
from C:\Users\chris.gray\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLEDevice.h:39,
from C:\Users\chris.gray\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLEServer.h:26,
from C:\Users\chris.gray\AppData\Local\Temp.arduinoIDE-unsaved2025927-17936-az8vqz.oogsb\Server\Server.ino:9:
C:\Users\chris.gray\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLEDescriptor.h:82:7: error: redefinition of 'class BLEDescriptor'
82 | class BLEDescriptor {
|       ^~~~~~~~~~~~~
In file included from c:\Users\chris.gray\Documents\Arduino\libraries\ArduinoBLE\src/BLECharacteristic.h:25,
from c:\Users\chris.gray\Documents\Arduino\libraries\ArduinoBLE\src/BLEService.h:23,
from c:\Users\chris.gray\Documents\Arduino\libraries\ArduinoBLE\src/BLEDevice.h:25,
from C:\Users\chris.gray\AppData\Local\Temp.arduinoIDE-unsaved2025927-17936-az8vqz.oogsb\Server\Server.ino:7:
c:\Users\chris.gray\Documents\Arduino\libraries\ArduinoBLE\src/BLEDescriptor.h:28:7: note: previous definition of 'class BLEDescriptor'
28 | class BLEDescriptor {
|       ^~~~~~~~~~~~~
C:\Users\chris.gray\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLECharacteristic.h:129:7: error: redefinition of 'class BLECharacteristic'
129 | class BLECharacteristic {
|       ^~~~~~~~~~~~~~~~~
c:\Users\chris.gray\Documents\Arduino\libraries\ArduinoBLE\src/BLECharacteristic.h:45:7: note: previous definition of 'class BLECharacteristic'
45 | class BLECharacteristic  {
|       ^~~~~~~~~~~~~~~~~
C:\Users\chris.gray\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLEService.h:102:7: error: redefinition of 'class BLEService'
102 | class BLEService {
|       ^~~~~~~~~~
c:\Users\chris.gray\Documents\Arduino\libraries\ArduinoBLE\src/BLEService.h:28:7: note: previous definition of 'class BLEService'
28 | class BLEService {
|       ^~~~~~~~~~
C:\Users\chris.gray\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLEDevice.h:155:7: error: redefinition of 'class BLEDevice'
155 | class BLEDevice {
|       ^~~~~~~~~
c:\Users\chris.gray\Documents\Arduino\libraries\ArduinoBLE\src/BLEDevice.h:39:7: note: previous definition of 'class BLEDevice'
39 | class BLEDevice {
|       ^~~~~~~~~
C:\Users\chris.gray\AppData\Local\Temp.arduinoIDE-unsaved2025927-17936-az8vqz.oogsb\Server\Server.ino: In function 'void setup()':
C:\Users\chris.gray\AppData\Local\Temp.arduinoIDE-unsaved2025927-17936-az8vqz.oogsb\Server\Server.ino:21:14: error: 'init' is not a member of 'BLEDevice'
21 |   BLEDevice::init("Long name works now");
|              ^~~~
C:\Users\chris.gray\AppData\Local\Temp.arduinoIDE-unsaved2025927-17936-az8vqz.oogsb\Server\Server.ino:22:35: error: 'createServer' is not a member of 'BLEDevice'
22 |   BLEServer *pServer = BLEDevice::createServer();
|                                   ^~~~~~~~~~~~
C:\Users\chris.gray\AppData\Local\Temp.arduinoIDE-unsaved2025927-17936-az8vqz.oogsb\Server\Server.ino:25:15: error: 'class BLEService' has no member named 'createCharacteristic'; did you mean 'addCharacteristic'?
25 |     pService->createCharacteristic(CHARACTERISTIC_UUID, BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_WRITE);
|               ^~~~~~~~~~~~~~~~~~~~
|               addCharacteristic
C:\Users\chris.gray\AppData\Local\Temp.arduinoIDE-unsaved2025927-17936-az8vqz.oogsb\Server\Server.ino:25:76: error: 'PROPERTY_READ' is not a member of 'BLECharacteristic'
25 |     pService->createCharacteristic(CHARACTERISTIC_UUID, BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_WRITE);
|                                                                            ^~~~~~~~~~~~~
C:\Users\chris.gray\AppData\Local\Temp.arduinoIDE-unsaved2025927-17936-az8vqz.oogsb\Server\Server.ino:25:111: error: 'PROPERTY_WRITE' is not a member of 'BLECharacteristic'
25 |     pService->createCharacteristic(CHARACTERISTIC_UUID, BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_WRITE);
|                                                                                                               ^~~~~~~~~~~~~~
C:\Users\chris.gray\AppData\Local\Temp.arduinoIDE-unsaved2025927-17936-az8vqz.oogsb\Server\Server.ino:28:13: error: 'class BLEService' has no member named 'start'
28 |   pService->start();
|             ^~~~~
C:\Users\chris.gray\AppData\Local\Temp.arduinoIDE-unsaved2025927-17936-az8vqz.oogsb\Server\Server.ino:30:45: error: 'getAdvertising' is not a member of 'BLEDevice'
30 |   BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();
|                                             ^~~~~~~~~~~~~~
C:\Users\chris.gray\AppData\Local\Temp.arduinoIDE-unsaved2025927-17936-az8vqz.oogsb\Server\Server.ino:35:14: error: 'startAdvertising' is not a member of 'BLEDevice'
35 |   BLEDevice::startAdvertising();
|              ^~~~~~~~~~~~~~~~
Multiple libraries were found for "BLEDevice.h"
Used: C:\Users\chris.gray\Documents\Arduino\libraries\ArduinoBLE
Not used: C:\Users\chris.gray\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE
exit status 1

Compilation error: 'init' is not a member of 'BLEDevice'

OK, I see the problem here:

Background

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.

Explanation

This is a case where Arduino IDE made the wrong decision when discovering the library for the #include <BLEDevice.h> directive in your sketch program code.

A file of that name is present in the "ArduinoBLE" library as well as in the "ESP32 BLE Arduino" library that is bundled with the "esp32" boards platform installation. The IDE chose to use the "ArduinoBLE" library, but your sketch is meant to use the "ESP32 BLE Arduino" library that is bundled with the "esp32" boards platform.

Solution

There are a couple of possible solutions to this problem. I'll describe them below. You can pick whichever one of the two is most suitable for you:

Uninstall Problematic Library

If you don't actually have any use for the "ArduinoBLE" library, then you can solve the problem by simply uninstalling the library.

I'll provide instructions you can follow to do that:

  1. Select Sketch > Include Library > Manage Libraries... from the Arduino IDE menus to open the "Library Manager" view in the left side panel.
  2. Type ArduinoBLE in the "Filter your search..." field.
  3. Scroll down through the list of libraries until you see the "ArduinoBLE" entry.
  4. Hover the mouse pointer over the "ArduinoBLE" entry.
  5. You will see a ●●● icon appear near the top right corner of the library entry. Click on that icon.
    A context menu will open.
  6. Select "Remove" from the menu.
    An "Uninstall" dialog will open.
  7. Click the "YES" button in the "Uninstall" dialog to confirm that you want to uninstall the library.
    The dialog will close.
  8. Wait for the uninstall process to finish, as indicated by a notification at the bottom right corner of the Arduino IDE window:

    ⓘ Successfully uninstalled library ...

Force Arduino IDE to Choose Correct Library

If you do need the "ArduinoBLE" library for use in other projects, then the other solution will not be acceptable.

In this case the solution will be to influence the library discovery system to chose the "ESP32 BLE Arduino" library over the "ArduinoBLE" library.

As I mentioned before, files from the folders listed in the compiler's search path are always given priority by the library discovery system. Once a library is "discovered", its path is added to the 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 again. Hopefully this time the error will not occur and everything will work as expected.

You got it!

Solved. I chose to include the extra include, and put it at the top of the list. Compiled with no issues.

Thanks a lot

You are welcome. I'm glad it is working now.

Regards, Per

Hi Per,
I tried find mentioned library ESP32-S3 Arduino, but I can not find in the list, I have to have instal some another libraries trought references ?
I have same problem and I can not active bluetooth for connection for RainMaker.
Thakns, Martin

Hi @martingalik.

There is no mention of a "ESP32-S3 Arduino" library in this topic.

Are you maybe thinking of the "ESP32 BLE Arduino" library?

Yes, you are correct,, it is ESP32 BLE Arduino. I can not active BLE in my ESP32-S3, than I try find any solution for solve.

I'm not sure I understood correctly what you mean by "can not active BLE". Please provide a more detailed description of what you mean in a reply on this forum topic to help us to understand it.

Make sure to include the following information:

  • What did you do?
  • What were the results you expected from doing that thing?
  • What were the results you observed that did not match your expectations?

If you encountered any errors or warnings, please provide the full and exact text of those messages.

I want communicate with ESP32-S3 via bluetooth and did not find any correct libery.

The correct library is bundled with the installation of the "esp32" boards platform you installed to add support for the ESP32 to Arduino IDE.

You can learn how to use the library from the documentation here:

and by studying the demonstration sketches that are available under the File > Examples > BLE in Arduino IDE.