Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not build ESP32-BLE-Keyboard of example in window 11 #313

Open
DangChinh1496 opened this issue Jul 14, 2024 · 4 comments
Open

Can not build ESP32-BLE-Keyboard of example in window 11 #313

DangChinh1496 opened this issue Jul 14, 2024 · 4 comments

Comments

@DangChinh1496
Copy link

debug screen is:

C:\Users\GUEST01\Documents\Arduino\libraries\ESP32_BLE_Keyboard\BleKeyboard.cpp: In member function 'void BleKeyboard::begin()':
C:\Users\GUEST01\Documents\Arduino\libraries\ESP32_BLE_Keyboard\BleKeyboard.cpp:106:19: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string'} to 'String'
106 | BLEDevice::init(deviceName);
| ^~~~~~~~~~
| |
| std::string {aka std::__cxx11::basic_string}
In file included from C:\Users\GUEST01\Documents\Arduino\libraries\ESP32_BLE_Keyboard\BleKeyboard.cpp:9:
C:\Users\GUEST01\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\BLE\src/BLEDevice.h:41:27: note: initializing argument 1 of 'static void BLEDevice::init(String)'
41 | static void init(String deviceName); // Initialize the local BLE environment.
| ~~~~~~~^~~~~~~~~~
C:\Users\GUEST01\Documents\Arduino\libraries\ESP32_BLE_Keyboard\BleKeyboard.cpp:117:32: error: no matching function for call to 'BLECharacteristic::setValue(std::string&)'
117 | hid->manufacturer()->setValue(deviceManufacturer);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from C:\Users\GUEST01\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\BLE\src/BLEHIDDevice.h:17,
from C:\Users\GUEST01\Documents\Arduino\libraries\ESP32_BLE_Keyboard\BleKeyboard.h:24,
from C:\Users\GUEST01\Documents\Arduino\libraries\ESP32_BLE_Keyboard\BleKeyboard.cpp:1:
C:\Users\GUEST01\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\BLE\src/BLECharacteristic.h:77:8: note: candidate: 'void BLECharacteristic::setValue(uint8_t*, size_t)'
77 | void setValue(uint8_t *data, size_t size);
| ^~~~~~~~
C:\Users\GUEST01\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\BLE\src/BLECharacteristic.h:77:8: note: candidate expects 2 arguments, 1 provided
C:\Users\GUEST01\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\BLE\src/BLECharacteristic.h:78:8: note: candidate: 'void BLECharacteristic::setValue(String)'
78 | void setValue(String value);
| ^~~~~~~~
C:\Users\GUEST01\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\BLE\src/BLECharacteristic.h:78:24: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string'} to 'String'
78 | void setValue(String value);
| ~~~~~~~^~~~~
C:\Users\GUEST01\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\BLE\src/BLECharacteristic.h:79:8: note: candidate: 'void BLECharacteristic::setValue(uint16_t&)'
79 | void setValue(uint16_t &data16);
| ^~~~~~~~
C:\Users\GUEST01\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\BLE\src/BLECharacteristic.h:79:27: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string'} to 'uint16_t&' {aka 'short unsigned int&'}
79 | void setValue(uint16_t &data16);
| ~~~~~~~~~~^~~~~~
C:\Users\GUEST01\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\BLE\src/BLECharacteristic.h:80:8: note: candidate: 'void BLECharacteristic::setValue(uint32_t&)'
80 | void setValue(uint32_t &data32);
| ^~~~~~~~
C:\Users\GUEST01\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\BLE\src/BLECharacteristic.h:80:27: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string'} to 'uint32_t&' {aka 'long unsigned int&'}
80 | void setValue(uint32_t &data32);
| ~~~~~~~~~~^~~~~~
C:\Users\GUEST01\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\BLE\src/BLECharacteristic.h:81:8: note: candidate: 'void BLECharacteristic::setValue(int&)'
81 | void setValue(int &data32);
| ^~~~~~~~
C:\Users\GUEST01\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\BLE\src/BLECharacteristic.h:81:22: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string'} to 'int&'
81 | void setValue(int &data32);
| ~~~~~^~~~~~
C:\Users\GUEST01\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\BLE\src/BLECharacteristic.h:82:8: note: candidate: 'void BLECharacteristic::setValue(float&)'
82 | void setValue(float &data32);
| ^~~~~~~~
C:\Users\GUEST01\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\BLE\src/BLECharacteristic.h:82:24: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string'} to 'float&'
82 | void setValue(float &data32);
| ~~~~~~~^~~~~~
C:\Users\GUEST01\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\BLE\src/BLECharacteristic.h:83:8: note: candidate: 'void BLECharacteristic::setValue(double&)'
83 | void setValue(double &data64);
| ^~~~~~~~
C:\Users\GUEST01\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\BLE\src/BLECharacteristic.h:83:25: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string'} to 'double&'
83 | void setValue(double &data64);
| ~~~~~~~~^~~~~~

exit status 1

Compilation error: exit status 1

@DangChinh1496 DangChinh1496 changed the title Can not build ESP32-BLE-Keyboard of example in window Can not build ESP32-BLE-Keyboard of example in window 11 Jul 14, 2024
@santalex
Copy link

if you are using Arduino IDE, you can try platformio, it feels like Arduino IDE's problem.

@eticaretmuhendisi
Copy link

Esp32's core files have been modified with 3.0.0, so there is an incompatibility. The workaround is to revert to version 2.0.17 until the library developers bring an update.

@Zer0TheObserver
Copy link

That's all you need to do:
1, Open BleKeyBoard.ccp in the ESP32_BLE_Keyboard lib
2, change "hid->manufacturer()->setValue(deviceManufacturer);" TO "hid->manufacturer()->setValue(String(deviceManufacturer.c_str()));"

3, change "BLEDevice::init(deviceName);" TO "BLEDevice::init(String(deviceName.c_str()));"
Run it again.

@dragon2777
Copy link

That's all you need to do: 1, Open BleKeyBoard.ccp in the ESP32_BLE_Keyboard lib 2, change "hid->manufacturer()->setValue(deviceManufacturer);" TO "hid->manufacturer()->setValue(String(deviceManufacturer.c_str()));"

3, change "BLEDevice::init(deviceName);" TO "BLEDevice::init(String(deviceName.c_str()));" Run it again.

amazing. thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants