I simply want to convert a float into a string or at least a char array. However I always get wrong returns. For example the length is over 150000 while I want to convert 3.3... For integer to_string works great. But not floating points.
I simply want to convert a float into a string or at least a char array. However I always get wrong returns. For example the length is over 150000 while I want to convert 3.3... For integer to_string works great. But not floating points.
string str=to_string(3.3f);
Hi,
How are you enabling C++ support in the project? What C++ libraries have you enabled? I am not sure if for instance the Minimal C++ Library supports to_string for floating point numbers.
Also, do you get any warnings when building the project?
Regards,
Terje
Hi,
How are you enabling C++ support in the project? What C++ libraries have you enabled? I am not sure if for instance the Minimal C++ Library supports to_string for floating point numbers.
Also, do you get any warnings when building the project?
Regards,
Terje
This is my project conf file
CONFIG_LOG=y CONFIG_STDOUT_CONSOLE=y CONFIG_I2C=y CONFIG_SENSOR=y CONFIG_SENSOR_LOG_LEVEL_DBG=y CONFIG_CBPRINTF_FP_SUPPORT=y # Bluetooth LE CONFIG_BT=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_NUS=y CONFIG_BT_DEVICE_NAME="MY_LBS1" CONFIG_NEWLIB_LIBC_MIN_REQUIRED_HEAP_SIZE=2048 CONFIG_DEBUG_THREAD_INFO=y CONFIG_NO_OPTIMIZATIONS=y ### C++ ### CONFIG_LOG_BACKEND_UART=y CONFIG_STD_CPP20=y CONFIG_CPP_MAIN=y CONFIG_CPLUSPLUS=y CONFIG_LIB_CPLUSPLUS=y
The minimal c++ is not found by the following line
CONFIG_MINIMAL_LIBCPP=y