Page 1 of 1

std::to_string()

Posted: Sat Dec 07, 2019 3:47 pm
by jandarm
In gcc 5.2.0 compiler, by default, when trying to use std::to_string(), you get an error

Code: Select all

error: 'to_string' is not a member of 'std'
I found that if the following defines are enabled (added to Preprocessor) in gcc-5.2.0 (nndk 2.8.x)

Code: Select all

_GLIBCXX_USE_C99
_GLIBCXX_USE_C99_DYNAMIC
For gcc 8.1.0 (nndk 3.0.0):

Code: Select all

_GLIBCXX_USE_C99_STDIO
then the code compiles successfully. See attached screenshot (example from cppreference).

I don’t know why so far no one on the forum has asked about std::to_string(), because this function is convenient and needed in every project...

Maybe because it can throw an exception, and NetBurner consumers in most cases write code only for safety-critical projects in C-style without using any exceptions?