T-vK / ESP32-BLE-Keyboard

Bluetooth LE Keyboard library for the ESP32 (Arduino IDE compatible)
2.47k stars 415 forks source link

syntax errors related to String() when compiling with Arduino IDE 2.3.3 #324

Open chstear opened 1 month ago

chstear commented 1 month ago

Errors when compiling in Arduino IDE 2.3.3 like the following:

/Users/chuck/Documents/Arduino/libraries/ESP32_BLE_Keyboard/BleKeyboard.cpp:106:19: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'String'
  106 |   BLEDevice::init(deviceName);
      |                   ^~~~~~~~~~
      |                   |
      |                   std::string {aka std::__cxx11::basic_string<char>}

and

/Users/chuck/Documents/Arduino/libraries/ESP32_BLE_Keyboard/BleKeyboard.cpp: In constructor 'BleKeyboard::BleKeyboard(String, String, uint8_t)':
/Users/chuck/Documents/Arduino/libraries/ESP32_BLE_Keyboard/BleKeyboard.cpp:101:37: error: 'class String' has no member named 'substr'
  101 |     , deviceName(String(deviceName).substr(0, 15))
      |                                     ^~~~~~

Reference to #322.