0

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/basic_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

In the code I use other C++11 modules like map, vector, threads, queu etc. and if I comment the line that calls to_string() all is compiled and runs just fine. This excludes include path mistakes.

If I compile the same code for my local machine, x86 ubuntu 14, I don't get this error anymore.

I tried to look inside toolchain include directory and couldn't find the C++ headers. On my local machine I can find them in this path: /usr/include/c++/4.8

Why is this difference regarding std::to_string between my host and the target include files ? When I compile for the target, where are the headers taken from? How can I find out the path of each header file used by g++ ?

user1934513
  • 693
  • 4
  • 21

0 Answers0