Compiler options

I am trying to use xtensor in a kendryte-standalone-sdk project, I am getting an error which mostly requires a compiler option to be given.

include/xtensor/xexception.hpp:123:61: error: ‘to_string’ is not a member of ‘std’

Can you let me know which option should be given and what should be entered in platformio.ini for this option to take effect.

Edit: the c_cpp_properties.json file has
“cppStandard”: “c++17”,
as far as I know to_string is supported since c++11 so it should work?

I have also looked at this to set verbose mode during building using tasks, however when I add args in the task.json it shows an error saying property args not allowed. How do I set verbose mode in a task.

This should not be necessary, just execute the “Verbose Build” task (PlatformIO IDE for VSCode — PlatformIO latest documentation).

Can you copy the exact error and the compiler invocation from the line above it? It should reveal then what -std=c++<..> version is used.

The build scripts inherit the setting from here

So C++17 is correct and std::to_string() should still work.

Thank you for trying to help me.

The c++ file is called region_layer.cpp the following is the verbose output which shows how it is compiled, this is the file which has the xtensor include definitions

riscv64-unknown-elf-g++ -o project_build_files/sipeed-maix-one-dock-test/src/region_layer.o -c -std=gnu++17 -mcmodel=medany -mabi=lp64f -march=rv64imafc -fno-common -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -fno-zero-initialized-in-bss -Os -ggdb -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-multichar -Wextra -Werror=frame-larger-than=65536 -Wno-unused-parameter -Wno-sign-compare -Wno-error=missing-braces -Wno-error=return-type -Wno-error=pointer-sign -Wno-missing-braces -Wno-strict-aliasing -Wno-implicit-fallthrough -Wno-missing-field-initializers -Wno-int-to-pointer-cast -Wno-error=comment -Wno-error=logical-not-parentheses -Wno-error=duplicate-decl-specifier -Wno-error=parentheses -Wno-error=maybe-uninitialized -DPLATFORMIO=40201 -DCONFIG_LOG_ENABLE -DCONFIG_LOG_LEVEL=LOG_INFO -DDEBUG=1 -D__riscv64 -DK210 -DARCH=K210 -DF_CPU=400000000L -DNNCASE_TARGET=k210 -DTCB_SPAN_NO_EXCEPTIONS -DTCB_SPAN_NO_CONTRACT_CHECKING -Iinclude -Isrc -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/bsp -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/bsp/include -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/drivers -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/drivers/include -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/freertos -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/freertos/include -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/freertos/portable -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/freertos/conf -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/utils/include -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/nncase -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/nncase/include -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/nncase/runtime -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/third_party/xtl/include src/region_layer.cpp

However the error occurs much after the file gets compiled. I am pasting it as a separate message so that its not cluttered.

riscv64-unknown-elf-gcc -o project_build_files/sipeed-maix-one-dock-test/sdk-bsp/syscalls.o -c -std=gnu11 -Wno-pointer-to-int-cast -Wno-old-style-declaration -mcmodel=medany -mabi=lp64f -march=rv64imafc -fno-common -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -fno-zero-initialized-in-bss -Os -ggdb -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-multichar -Wextra -Werror=frame-larger-than=65536 -Wno-unused-parameter -Wno-sign-compare -Wno-error=missing-braces -Wno-error=return-type -Wno-error=pointer-sign -Wno-missing-braces -Wno-strict-aliasing -Wno-implicit-fallthrough -Wno-missing-field-initializers -Wno-int-to-pointer-cast -Wno-error=comment -Wno-error=logical-not-parentheses -Wno-error=duplicate-decl-specifier -Wno-error=parentheses -Wno-error=maybe-uninitialized -DPLATFORMIO=40201 -DCONFIG_LOG_ENABLE -DCONFIG_LOG_LEVEL=LOG_INFO -DDEBUG=1 -D__riscv64 -DK210 -DARCH=K210 -DF_CPU=400000000L -DNNCASE_TARGET=k210 -DTCB_SPAN_NO_EXCEPTIONS -DTCB_SPAN_NO_CONTRACT_CHECKING -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/bsp -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/bsp/include -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/drivers -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/drivers/include -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/freertos -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/freertos/include -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/freertos/portable -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/freertos/conf -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/utils/include -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/nncase -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/nncase/include -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/nncase/runtime -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/third_party/xtl/include /home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/bsp/syscalls.c
In file included from include/xtensor/xiterator.hpp:18,
                 from include/xtensor/xiterable.hpp:12,
                 from include/xtensor/xcontainer.hpp:17,
                 from include/xtensor/xarray.hpp:17,
                 from src/region_layer.cpp:11:
include/xtensor/xexception.hpp: In function 'void xt::detail::check_index_impl(const S&, std::size_t, Args ...)':
include/xtensor/xexception.hpp:123:61: error: 'to_string' is not a member of 'std'
                     throw std::out_of_range("index " + std::to_string(arg) + " is out of bounds for axis "
                                                             ^~~~~~~~~
include/xtensor/xexception.hpp:124:32: error: 'to_string' is not a member of 'std'
                         + std::to_string(dim) + " with size " + std::to_string(shape[dim]));
                                ^~~~~~~~~
include/xtensor/xexception.hpp:124:70: error: 'to_string' is not a member of 'std'
                         + std::to_string(dim) + " with size " + std::to_string(shape[dim]));
                                                                      ^~~~~~~~~
include/xtensor/xexception.hpp: In function 'void xt::check_element_index(const S&, It, It)':
include/xtensor/xexception.hpp:147:57: error: 'to_string' is not a member of 'std'
                 throw std::out_of_range("index " + std::to_string(*efirst) + " is out of bounds for axis "
                                                         ^~~~~~~~~
include/xtensor/xexception.hpp:148:28: error: 'to_string' is not a member of 'std'
                     + std::to_string(axis) + " with size " + std::to_string(shape[axis]));
                            ^~~~~~~~~
include/xtensor/xexception.hpp:148:67: error: 'to_string' is not a member of 'std'
                     + std::to_string(axis) + " with size " + std::to_string(shape[axis]));
                                                                   ^~~~~~~~~
riscv64-unknown-elf-ar rcs project_build_files/sipeed-maix-one-dock-test/libsdk-bsp.a project_build_files/sipeed-maix-one-dock-test/sdk-bsp/crt.o project_build_files/sipeed-maix-one-dock-test/sdk-bsp/entry.o project_build_files/sipeed-maix-one-dock-test/sdk-bsp/entry_user.o project_build_files/sipeed-maix-one-dock-test/sdk-bsp/interrupt.o project_build_files/sipeed-maix-one-dock-test/sdk-bsp/locks.o project_build_files/sipeed-maix-one-dock-test/sdk-bsp/printf.o project_build_files/sipeed-maix-one-dock-test/sdk-bsp/sleep.o project_build_files/sipeed-maix-one-dock-test/sdk-bsp/syscalls.o
riscv64-unknown-elf-ranlib project_build_files/sipeed-maix-one-dock-test/libsdk-bsp.a
riscv64-unknown-elf-gcc -o project_build_files/sipeed-maix-one-dock-test/sdk-drivers/aes.o -c -std=gnu11 -Wno-pointer-to-int-cast -Wno-old-style-declaration -mcmodel=medany -mabi=lp64f -march=rv64imafc -fno-common -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -fno-zero-initialized-in-bss -Os -ggdb -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-multichar -Wextra -Werror=frame-larger-than=65536 -Wno-unused-parameter -Wno-sign-compare -Wno-error=missing-braces -Wno-error=return-type -Wno-error=pointer-sign -Wno-missing-braces -Wno-strict-aliasing -Wno-implicit-fallthrough -Wno-missing-field-initializers -Wno-int-to-pointer-cast -Wno-error=comment -Wno-error=logical-not-parentheses -Wno-error=duplicate-decl-specifier -Wno-error=parentheses -Wno-error=maybe-uninitialized -DPLATFORMIO=40201 -DCONFIG_LOG_ENABLE -DCONFIG_LOG_LEVEL=LOG_INFO -DDEBUG=1 -D__riscv64 -DK210 -DARCH=K210 -DF_CPU=400000000L -DNNCASE_TARGET=k210 -DTCB_SPAN_NO_EXCEPTIONS -DTCB_SPAN_NO_CONTRACT_CHECKING -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/bsp -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/bsp/include -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/drivers -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/drivers/include -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/freertos -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/freertos/include -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/freertos/portable -I/home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk-develop/lib/freertos/conf -I/home/krishnak/.platformio/packages/framework-kendryte-standaloIn file included from include/xtensor/xcontainer.hpp:19,
                 from include/xtensor/xarray.hpp:17,
ne-sdk-develop/lib/utils/i                 from src/region_layer.cpp:11:
nclude -I/home/krinclude/xtensor/xmath.hpp: In member function 'constexpr T xt::math::remainder_fun<T>::operator()(const T&, const T&) const':
ishnak/.platformio/packages/framinclude/xtensor/xmath.hpp:127:29: error: 'std::remainder' has not been declared
ework-kendryte-standalone-s         BINARY_MATH_FUNCTOR(remainder);
dk-develop/li                             ^~~~b/nncase ~~-~I~/~h
include/xtensor/xmath.hpp:89:24: note: in definition of macro 'BINARY_MATH_FUNCTOR'
ome/krishnak/.platformio             using std::NAME;                                       \
/packages/framework-kendr                        ^~~~
yte-standaloinclude/xtensor/xmath.hpp: In member function 'constexpr T xt::math::fma_fun<T>::operator()(const T&, const T&, const T&) const':
ne-sdk-develop/lib/nncase/include -Iinclude/xtensor/xmath.hpp:128:30: error: 'std::fma' has not been declared
/home/krishnak/.platform         TERNARY_MATH_FUNCTOR(fma);
io/packages/                              ^~~
framework-kendinclude/xtensor/xmath.hpp:104:24: note: in definition of macro 'TERNARY_MATH_FUNCTOR'
ryte-standalone-sdk-devel             using std::NAME;                                                      \
op/lib/nncase/runtime -I/home/kr                        ^~~~
ishnak/.plainclude/xtensor/xmath.hpp: In member function 'constexpr T xt::math::fmax_fun<T>::operator()(const T&, const T&) const':
tformio/packages/framework-kendrytinclude/xtensor/xmath.hpp:129:29: error: 'std::fmax' has not been declared
e-standalone-sdk-develop/         BINARY_MATH_FUNCTOR(fmax);
third_party/                             ^~~~
xtl/include /hinclude/xtensor/xmath.hpp:89:24: note: in definition of macro 'BINARY_MATH_FUNCTOR'
ome/krishnak/.platformio/pa             using std::NAME;                                       \
ckages/framework-kendryte                        ^~~~
-standalone-sdkinclude/xtensor/xmath.hpp: In member function 'constexpr T xt::math::fmin_fun<T>::operator()(const T&, const T&) const':
-develop/lib/drivers/ainclude/xtensor/xmath.hpp:130:29: error: 'std::fmin' has not been declared
es.c
         BINARY_MATH_FUNCTOR(fmin);
                             ^~~~
include/xtensor/xmath.hpp:89:24: note: in definition of macro 'BINARY_MATH_FUNCTOR'
             using std::NAME;                                       \
                        ^~~~
include/xtensor/xmath.hpp: In member function 'constexpr T xt::math::fdim_fun<T>::operator()(const T&, const T&) const':
include/xtensor/xmath.hpp:131:29: error: 'std::fdim' has not been declared
         BINARY_MATH_FUNCTOR(fdim);
                             ^~~~
include/xtensor/xmath.hpp:89:24: note: in definition of macro 'BINARY_MATH_FUNCTOR'
             using std::NAME;                                       \
                        ^~~~
include/xtensor/xmath.hpp: In member function 'constexpr T xt::math::exp2_fun<T>::operator()(const T&) const':
include/xtensor/xmath.hpp:133:28: error: 'std::exp2' has not been declared
         UNARY_MATH_FUNCTOR(exp2);
                            ^~~~
include/xtensor/xmath.hpp:62:24: note: in definition of macro 'UNARY_MATH_FUNCTOR'
             using std::NAME;                       \
                        ^~~~
include/xtensor/xmath.hpp: In member function 'constexpr T xt::math::expm1_fun<T>::operator()(const T&) const':
include/xtensor/xmath.hpp:134:28: error: 'std::expm1' has not been declared
         UNARY_MATH_FUNCTOR(expm1);
                            ^~~~~
include/xtensor/xmath.hpp:62:24: note: in definition of macro 'UNARY_MATH_FUNCTOR'
             using std::NAME;                       \
                        ^~~~
include/xtensor/xmath.hpp: In member function 'constexpr T xt::math::log2_fun<T>::operator()(const T&) const':
include/xtensor/xmath.hpp:137:28: error: 'std::log2' has not been declared
         UNARY_MATH_FUNCTOR(log2);
                            ^~~~
include/xtensor/xmath.hpp:62:24: note: in definition of macro 'UNARY_MATH_FUNCTOR'
             using std::NAME;                       \
                        ^~~~
include/xtensor/xmath.hpp: In member function 'constexpr T xt::math::log1p_fun<T>::operator()(const T&) const':
include/xtensor/xmath.hpp:138:28: error: 'std::log1p' has not been declared
         UNARY_MATH_FUNCTOR(log1p);
                            ^~~~~
include/xtensor/xmath.hpp:62:24: note: in definition of macro 'UNARY_MATH_FUNCTOR'
             using std::NAME;                       \
                        ^~~~
include/xtensor/xmath.hpp: In member function 'constexpr T xt::math::cbrt_fun<T>::operator()(const T&) const':
include/xtensor/xmath.hpp:141:28: error: 'std::cbrt' has not been declared
         UNARY_MATH_FUNCTOR(cbrt);
                            ^~~~
include/xtensor/xmath.hpp:62:24: note: in definition of macro 'UNARY_MATH_FUNCTOR'
             using std::NAME;                       \
                        ^~~~
include/xtensor/xmath.hpp: In member function 'constexpr T xt::math::erf_fun<T>::operator()(const T&) const':
include/xtensor/xmath.hpp:156:28: error: 'std::erf' has not been declared
         UNARY_MATH_FUNCTOR(erf);
                            ^~~
include/xtensor/xmath.hpp:62:24: note: in definition of macro 'UNARY_MATH_FUNCTOR'
             using std::NAME;                       \
                        ^~~~
include/xtensor/xmath.hpp: In member function 'constexpr T xt::math::erfc_fun<T>::operator()(const T&) const':
include/xtensor/xmath.hpp:157:28: error: 'std::erfc' has not been declared
         UNARY_MATH_FUNCTOR(erfc);
                            ^~~~
include/xtensor/xmath.hpp:62:24: note: in definition of macro 'UNARY_MATH_FUNCTOR'
             using std::NAME;                       \
                        ^~~~
include/xtensor/xmath.hpp: In member function 'constexpr T xt::math::tgamma_fun<T>::operator()(const T&) const':
include/xtensor/xmath.hpp:158:28: error: 'std::tgamma' has not been declared
         UNARY_MATH_FUNCTOR(tgamma);
                            ^~~~~~
include/xtensor/xmath.hpp:62:24: note: in definition of macro 'UNARY_MATH_FUNCTOR'
             using std::NAME;                       \
                        ^~~~
include/xtensor/xmath.hpp: In member function 'constexpr T xt::math::lgamma_fun<T>::operator()(const T&) const':
include/xtensor/xmath.hpp:159:28: error: 'std::lgamma' has not been declared
         UNARY_MATH_FUNCTOR(lgamma);
                            ^~~~~~
include/xtensor/xmath.hpp:62:24: note: in definition of macro 'UNARY_MATH_FUNCTOR'
             using std::NAME;                       \
                        ^~~~
include/xtensor/xmath.hpp: In member function 'constexpr T xt::math::trunc_fun<T>::operator()(const T&) const':
include/xtensor/xmath.hpp:162:28: error: 'std::trunc' has not been declared
         UNARY_MATH_FUNCTOR(trunc);
                            ^~~~~
include/xtensor/xmath.hpp:62:24: note: in definition of macro 'UNARY_MATH_FUNCTOR'
             using std::NAME;                       \
                        ^~~~
include/xtensor/xmath.hpp: In member function 'constexpr T xt::math::round_fun<T>::operator()(const T&) const':
include/xtensor/xmath.hpp:163:28: error: 'std::round' has not been declared
         UNARY_MATH_FUNCTOR(round);
                            ^~~~~
include/xtensor/xmath.hpp:62:24: note: in definition of macro 'UNARY_MATH_FUNCTOR'
             using std::NAME;                       \
                        ^~~~
include/xtensor/xmath.hpp: In member function 'constexpr T xt::math::nearbyint_fun<T>::operator()(const T&) const':
include/xtensor/xmath.hpp:164:28: error: 'std::nearbyint' has not been declared
         UNARY_MATH_FUNCTOR(nearbyint);
                            ^~~~~~~~~
include/xtensor/xmath.hpp:62:24: note: in definition of macro 'UNARY_MATH_FUNCTOR'
             using std::NAME;                       \
                        ^~~~
include/xtensor/xmath.hpp: In member function 'constexpr T xt::math::rint_fun<T>::operator()(const T&) const':
include/xtensor/xmath.hpp:165:28: error: 'std::rint' has not been declared
         UNARY_MATH_FUNCTOR(rint);
                            ^~~~
include/xtensor/xmath.hpp:62:24: note: in definition of macro 'UNARY_MATH_FUNCTOR'
             using std::NAME;                       \
                        ^~~~

Looks like the error occurs when syscalls.c is being compiled with gcc, how do I force it to use g++ assuming that to be the cause