OpenWrt Forum Archive

Topic: C++11 and Openwrt

The content of this topic has been archived on 4 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I'm trying to compile some C++11 code using the toolchain provided by openwrt. All works ok until I try to use std::to_string() function. According to this http://en.cppreference.com/w/cpp/string … /to_string , it should be defined in string. At compile time I get this eror:

hello.cpp:44:31: error: 'to_string' is not a member of 'std'
std::cout << "B115200 "<< std::to_string(B115200) << "\n";
make: *** [hello.o] Error 1

This seems to be an old known bug but which I could reproduce with openwrt toolchain (gcc 4.8 and 4.9) target system ar7xxx, target profile Atheros AP121
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52015

Do you think it is safe to remove the !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF) that guards to_string() ?

There is no issue with the paths since I use other c++ modules like map, vector, queue, threadss etc and they compile and run fine

The discussion might have continued from here.