OSC String name not compiling

Hi all thought this was something simple wanting to add integer x after /sensor/ but when I use that string in place of the example "/sensor/" where myString is I get the below error

  String myString = "/sensor/" + String(x);
 bndl.add(myString).add((int32_t)measurementData.distance_mm[x]);
Compilation error: no matching function for call to 'OSCBundle::add(String&)'

it's saying either there isn't an add() or an ad() with that type of argument: String &

these appear to be the options from OSCBundle.h

    OSCMessage & add( char * address);
    //add with nothing in it produces an invalid osc message
	//copies an existing message into the bundle
	OSCMessage & add(OSCMessage & msg);

Haven't tested it but it compiles

 char myString = "/sensor/" + char(x);

You need to use the underlying string since Strings are not supported as an argument:
bndl.add(myString.c_str()).add((int32_t)measurementData.distance_mm[x]);

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.