线程C ++:没有用于调用的匹配函数

用户名

我是c ++的新手,我想利用线程从主类调用BM类方法。我有main.cpp,BM.h和BM.cpp文件

我的代码在main.cpp中的某些部分

string id = res->getString("nct_id");
char txt[temp_size];
char pat[5];
BM bm ;
thread Sam(&BM::search,&bm, txt, pat ,id); // use thread calls class method

体重

void search( char *txt,  char *pat , string id);

BM.cpp

void BM::search( char *txt,  char *pat ,string id)

我有错误:

No matching function for call to
'std::thread::thread(void (BM::*)(char*, char*, std::string), BM*, char [(((sizetype)(((ssizetype)temp_size) + -1)) + 1)], char [5], std::string&)'

请帮我

谢谢你

代词

这是因为您使用的是非标准语言扩展,即可变长度数组(VLA)。这些数组不适用于模板。建议抛弃所有字符数组和所有VLA,并始终使用std:string和std :: vector。

如果不能,请使用以下简单的解决方法:

thread Sam(&BM::search,&bm, &txt[0], pat ,id); 

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

spring + jpa + hibernate =没有用于当前线程的具有实际事务的EntityManager-无法可靠地处理“持久”调用

C ++:没有用于初始化的匹配构造函数/候选构造函数不可行:需要单个参数,但未提供任何参数

C ++将lambda函数保存为成员变量,而没有用于优化的函数指针

C ++线程-没有匹配的函数来调用

在Rcpp中没有用于调用“ as”的匹配函数

构造函数中没有用于调用的匹配函数-C ++ 11

没有用于调用默认构造函数的匹配函数

默认构造函数错误,没有用于调用的匹配函数

错误:没有用于调用“构造函数”的匹配函数注意:候选对象是:

没有用于通信的I2c从站地址

C ++程序中没有用于big_endian检查的输出

C ++:没有匹配的函数来调用

C ++错误没有匹配的调用函数

在作为类“没有用于调用swap()的匹配函数”的成员的向量上调用sort()

C ++:没有匹配的函数可调用''

C ++中的多线程处理时出现“没有匹配的函数调用”错误

没有用于调用“类”的匹配函数

构建幕府将军时出错:没有用于调用“PyUnicode_AsUTF8AndSize”的匹配函数

g++ 错误:没有用于调用“fpclassify(float&)”的匹配函数

没有用于调用“currency::currency()”的匹配函数

没有用于调用 'bind(<未解析的重载函数类型>, const std::_Placeholder<1>&, int*) 的匹配函数

错误:没有用于调用“CreateFileW”的匹配函数

没有用于调用 Employee::Employee() 错误的匹配函数

错误:没有用于调用“std::vector<float>::push_back(std::vector<float>&) const”的匹配函数

没有用于调用 stof 的匹配函数

没有用于调用“regex_match”的匹配函数

错误:没有用于调用“std::vector<Movie>::erase(size_t&)”的匹配函数

错误:没有用于调用“DollarAmount::DollarAmount(<brace-enclosed initializer list>)”的匹配函数

没有用于调用“student::student()”错误的匹配函数