'dtostrf' was not declared in this scope

I am trying to converting float to string , the code works fine with standard Arduino IDE but throwing the error in Spark IDE , my code looks like this… I have include #include “spark_wiring_string.h” , still no luck…

float h = dht.getHumidity();
float t = dht.getTempCelcius();

char floatTempString[10];


please help me…

It is not declared in the header, so compiler can’t find it.

Why don’t you just use sprintf(floatTempString, "%2.2f", t)? It would be the same.

Thank You, I fixed this in diff. route , thanks to Dave’s prev. post. ,

float f = 43.0;
String s = String(f);
and do String concatenation , it is working now…

So dtostrf() is defined as a helper function in spark_wiring_string.cpp, but since it is not declared in the .h file, you would need to extern it to gain access.

It does not seem to be doc’ed in Arduino land, so I think the Spark team would have followed the doc in this case.

Still doesn’t seem to work without some tricks on Photon.


I’m not sure if it is part of Arduino, but is found here AVR libc

If anyone has any updates on this issue that’d be great.