Mbed os <charconv> libary error

I have the code below which is trying to save a message to a buffer 50 times and sending the message through UART once the buffer is full. The code works with an online c+ compiler (removed all the mbed os libaries and just printed to the console), but mbed would not compile this code due to the errors I added below. I am not sure how to fix this.

I am using mbed os 5.12.4 and my board is the b-l475-iot01a

code:

/**
 ******************************************************************************
 * @file    main.cpp
 * @author  CLab
 * @version V1.0.0
 * @date    5-September-2017
 * @brief   Simple Example application for using X_NUCLEO_IKS01A2  
 *          MEMS Inertial & Environmental Sensor Nucleo expansion and 
 *          B-L475E-IOT01A2 boards.
 ******************************************************************************
 * @attention
 *
 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *   1. Redistributions of source code must retain the above copyright notice,
 *      this list of conditions and the following disclaimer.
 *   2. Redistributions in binary form must reproduce the above copyright notice,
 *      this list of conditions and the following disclaimer in the documentation
 *      and/or other materials provided with the distribution.
 *   3. Neither the name of STMicroelectronics nor the names of its contributors
 *      may be used to endorse or promote products derived from this software
 *      without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 *  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 ******************************************************************************
*/ 

#define buf_size_tesla 50

/* Includes */
#include "mbed.h"
#include "HTS221Sensor.h"
#include "LPS22HBSensor.h"
#include "LSM6DSLSensor.h"
#include "lis3mdl_class.h"
#include "VL53L0X.h"
#include <iostream>
#include<cstring>
#include<charconv>


char* mystrcat( char* dest, char* src )
{
     while (*dest) dest++;
     while ((*dest++ = *src++) != '\0');
     return --dest;
}



int main() {
	Serial out(PB_6, PB_7, 921600);
  out.set_flow_control(mbed::SerialBase::Disabled);
  out.format(8, SerialBase::None, 1);
  
  char test_msg[] = "-1000,-2000,-3000";
  char buffer[buf_size_tesla * (sizeof(test_msg) + 10)]; //+10 needed to make space for the count 
  memset(buffer, 0, sizeof(buffer));


  int count = 0; 
  int global_count = 0; 
  char * p = buffer; 
  char count_str[10];

  while(1) {
    while(count != buf_size_tesla){
        p = mystrcat(p, test_msg);
        *p = ' '; //add a space before the count 
        
        std::to_chars_result res = std::to_chars(count_str, count_str + sizeof(count_str) - 1, global_count);
        char * res_p = res.ptr; 
        *res_p = '\r';
        *(++res_p) = '\n';
        *(++res_p) = '\0';
        p = mystrcat(p, count_str);
        
        count++;
        global_count++;
    }
    printf("%s",buffer);
    p = buffer; //reser the pointer to the start of the buffer 
    count = 0; 
    memset(buffer, 0, sizeof(buffer));
  }
}

error message:
std::to_chars_result res = std::to_chars(count_str, count_str + sizeof(count_str) - 1, global_count);
^~~
ref
c:\Users\nrahardja\AppData\Local\Mbed Studio\mbed-studio-tools\ac6\bin..\include\libcxx__functional_base:518:1: note: ‘ref’ declared here
ref(_Tp& __t) _NOEXCEPT
^
.\main.cpp:83:29: error: expected ‘;’ after expression
std::to_chars_result res = std::to_chars(count_str, count_str + sizeof(count_str) - 1, global_count);
^
;
.\main.cpp:83:14: error: no member named ‘to_chars_result’ in namespace ‘std’
std::to_chars_result res = std::to_chars(count_str, count_str + sizeof(count_str) - 1, global_count);

.\main.cpp:83:41: error: no member named 'to_chars' in namespace 'std'
std::to_chars_result res = std::to_chars(count_str, count_str + sizeof(count_str) - 1, global_count);
~~~~~^
.\main.cpp:84:24: error: use of undeclared identifier 'res'
char * res_p = res.ptr;
^
5 errors generated.

Hello Nicholas,

The to_chars_result data type is defined in the <charconv> header file if the following condition is met.

<charconv>:

...
// As an extension we support <charconv> in C++14, but this header should not
// be included by any other library headers in C++14 mode. This ensures that
// the names defined in this header are not added to namespace std unless a
// user explicitly includes <charconv> in C++14 code.
#if __cplusplus >= 201402L
...
  /// Result type of std::to_chars
  struct to_chars_result
  {
...

Unfortunately, the mbed online compiler does not seem to be C++14 compliant (__cplusplus is less than 201402L).

However, the code compiles fine off-line with the GCC ARM toolchain.