c++ – to_string not declared in scope
c++ – to_string not declared in scope
There could be different reasons why it doesnt work for you: perhaps you need to qualify the name with std::
, or perhaps you do not have C++11 support.
This works, provided you have C++11 support:
#include <string>
int main()
{
std::string s = std::to_string(42);
}
To enable C++11 support with g++ or clang, you need to pass the option -std=c++0x
. You can also use -std=c++11
on the newer versions of those compilers.
you must compile the file with c++11 support
g++ -std=c++0x -o test example.cpp
c++ – to_string not declared in scope
I fixed this problem by changing the first line in Application.mk from
APP_STL := gnustl_static
to
APP_STL := c++_static
Related posts on c++ :
- c++ – Argument list for class template is missing
- c++ – qualified-id in declaration before ( token
- Is it possible to decompile a C++ executable file
- c++ – Pointer to incomplete class type is not allowed
- c++ – error: request for member .. in .. which is of non-class type
- c++ – error: use of deleted function
- c++ – Reference to non-static member function must be called
- error : expected unqualified-id before return in c++
- c++ – undefined reference to vtable for class constructor