CPP 中没有构造函数错误的实例
No instance of constructor error in CPP
我试图创建一个函数来识别字符串中的匹配行。我的整个字符串保存在strStart中,strToMatch包含搜索字符串。以下是我的代码
void ExpertContextUser::removeMatchedString() {
String line;
String strStart="TestingnReturnsnrelatednresources";
String strToMatch="Test";
istringstream streamAddtText(strStart);
while(std::getline(streamAddtText, line)) {
cout << line << "Function" << endl;
if(line.index(strToMatch) > 0) {
TraceMessage <<" Test Success" << endl;
}
}
}
当我编译代码时,我收到以下错误
"../user_model_impl.cxx",第 234 行:错误 #2289:没有构造函数实例 "标准::basic_istringstream<_CharT,_Traits, _Allocator>::basic_istringstream [使用 _CharT=字符, _Traits=std::char_traits, _Allocator=std::分配器]" 匹配参数列表 参数类型为:(RWCString( istringstream streamAddtText(strStart(;
我找不到此错误的原因。
发生错误是因为istringstream
构造函数采用std::string
,而不是RWCString
。如果您希望此功能正常工作,则需要提供从RWCString
到std::string
的转换。
相关文章:
- 多个文件的内存分配错误"在抛出 'std :: bad_alloc' what (): std :: bad_alloc 的实例后终止调用" [C++]
- 我收到以下错误:抛出'std::bad_alloc'实例后终止调用
- 为什么包含windows.h会产生语法错误,从而阻止类的实例化?(C2146,C2065)
- 为什么创建友元类的实例会导致"undefined reference to"错误?
- 错误 没有与参数列表匹配的重载函数"getline"实例
- 错误的cv::face FacemarkLBF实例化
- C++应用程序 MySQL odbc 数据库连接错误:在引发"otl_tmpl_exception<>"实例后终止调用
- 无法使用 SWIG 在 Python 中实例化C++类(获取属性错误)
- 在抛出 'std::runtime_error' 的实例后终止调用 what(): Filebuf 和 ostream 的 I/O 错误
- gcc出现不明确的模板实例化错误
- 结构数组的构造函数错误,错误消息:没有构造函数实例与参数列表匹配
- 尝试实例化模板类的对象时出现"No Matching Constructor"错误
- 返回实例变量的c++方法可以访问变量中的数据,但不能更改它,但在编译时不会生成错误
- 使用to_string、reverse、stoi组合的C++反转编号给出运行时错误实例超出范围
- 无法实例化抽象类错误
- C++ Visual Studio 重载函数错误:没有重载函数的实例与指定的类型匹配
- 错误 C2280 / 在 std::vector 中实例化对象时复制构造函数出现问题?
- 为什么自删除的全局 Vulkan 实例仅在添加层时才导致段错误?
- "if (argc < 2 || argc > 2)"应该有 2 个参数吗?&终止在抛出'std::out_of_range'错误实例后调用
- 包含iostream时的自定义类时间的错误实例