Skip to content

Can't compile anymore on arduino 2.3 - conversion from 'String' to non-scalar type 'std::string' #88

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

Closed
antonvh opened this issue Jun 5, 2024 · 3 comments

Comments

@antonvh
Copy link

antonvh commented Jun 5, 2024

My code used to work, but sadly, I hit the update button. :/

Now compiling my sketch with BLE-MIDI returns this:

In file included from /Users/anton/Documents/Arduino/blemidi2/blemidi2.ino:2:
/Users/anton/Documents/Arduino/libraries/Arduino-BLE-MIDI/src/hardware/BLEMIDI_ESP32.h: In member function 'virtual void bleMidi::MyCharacteristicCallbacks::onWrite(BLECharacteristic*)':
/Users/anton/Documents/Arduino/libraries/Arduino-BLE-MIDI/src/hardware/BLEMIDI_ESP32.h:116:55: error: conversion from 'String' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
  116 |         std::string rxValue = characteristic->getValue();
      |                               ~~~~~~~~~~~~~~~~~~~~~~~~^~

exit status 1

Compilation error: exit status 1

I tried the other branches of this repo too.

I'm compiling for esp32

@antonvh
Copy link
Author

antonvh commented Jun 5, 2024

Solved. Found out how to use nimBLE with
#include <hardware/BLEMIDI_ESP32_NimBLE.h>

@antonvh antonvh closed this as completed Jun 5, 2024
@wiemax1093
Copy link

imo this is still a bug and needs to be fixed (just first experienced this under IDE 2.3.0/ fresh isntall and update of everything),

also for a workaround (for everyone), change line 116 in BLEMIDI_ESP32.h from:
std::string rxValue = characteristic->getValue();
to
String rxValue = characteristic->getValue();

thx to a similar problem over here that explained the root cause https://forum.arduino.cc/t/compilation-error-on-code-that-was-compiling-before-conversion-from-string-to-non-scalar-type/1265323 // espressif/arduino-esp32#8724

@lathoub maybe you can implement the change directly in a future update

@lathoub
Copy link
Owner

lathoub commented Aug 23, 2024

@wiemax1093 thx for signaling. If you make a PR, I'm happy to accept

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

3 participants