Issues with to_string
Issues with to_string
我尝试这样的编译时会出现以下错误。 c date.cc -std = C 11
" date.cc:41:40:错误:'to_string'不是'std'" "的成员
这是代码:
if ( _month < 1 || _month > 12 )
{
throw domain_error{"Month " + std::to_string(_month) + " doesn't exist!"};
}
如果我删除std ::我得到: "'to_string'在此范围中没有声明'
我的版本是:GCC版本5.3.0(GCC)
有什么建议?
std::to_string
在标题<string>
中定义。
您需要添加#include <string>
。
http://en.cppreference.com/w/cpp/string/basic_string/to_string
相关文章:
- C++:如何将 unix 时间的字符串转换为 *tm?(使用时间错误:"cannot convert 'String' to 'tm*' ")
- "No suitable conversion function from 'std::string' to 'const char *' exists"
- 使用词法强制转换在'string to double'中设置双精度变量的精度
- std::string to std::regex
- 如何 SWIG std::string& to C# ref string
- jni String to *char and java.lang.UnsatisfiedLinkError:
- 如何设计一个简单的 std::string-to-boost::p osix_time::p time 解析库
- C++ std::string to Ruby VALUE
- C++ CLI System.String^ to MFC LPCTSTR
- 使用C++中的String To Class Lookup表来实例化类
- 创建新文件时std::string to const char*错误
- 有没有办法"convert string to vector<int>"?
- std::string to LPOLESTR
- C++ stringstream string to function(test, char *test2)
- std::vector<std::string> to char* 数组
- C++: C string to std:string
- 施放一个提升::日志::表达式::attr< std::string > to std::string
- std::string to LPBYTE and RegEnumValueA
- 不能将convert std::string to LPWSTR放入函数中
- vector string to string (or c_string) to lpszString