Tag Archives: error C2039

How to Solve error C2039: “to_ String “: not a member of” STD “

To_string is a function only available in C++11. This error is probably the reason why it was used in older versions of C++Solutions:

#include <string>
#include <sstream>

template <typename T>
std::string to_string(T value)
{
	std::ostringstream os ;
	os << value ;
	return os.str() ;
}

int main()
{
	std::string perfect = to_string(5) ;
}