template_match.cpp:14:50: error: no matching function for call to ‘TemplateMatch::ParallelMatch(std::vector<std::__cxx11::basic_string<char> >::const_iterator, std::vector<std::__cxx11::basic_string<char> >::const_iterator)’ ParallelMatch(templates.begin(), templates.end()); ^ In file included from template_match.cpp:1:0: template_match.h:13:7: note: candidate: void TemplateMatch::ParallelMatch(std::vector<std::__cxx11::basic_string<char> >::iterator, std::vector<std::__cxx11::basic_string<char> >::iterator) void ParallelMatch(std::vector<std::string>::iterator first, std::vector<std::string>::iterator last);
时间: 2023-08-18 18:04:26 浏览: 68
这个错误提示表明在你的代码中调用了一个不存在的函数。具体来说,这个函数是`TemplateMatch::ParallelMatch`,它期望接收两个`std::vector<std::string>::iterator`类型的参数,但是你传入的却是`std::vector<std::__cxx11::basic_string<char> >::const_iterator`类型的参数,因此编译器找不到匹配的函数。
解决这个问题的方法是修改`ParallelMatch`函数的参数类型,将其改为`const_iterator`类型即可。同时,你也需要确保在调用`ParallelMatch`函数时传入正确的参数类型。
相关问题
src/template_match.cpp: In constructor ‘TemplateMatch::TemplateMatch(const std::vector<std::__cxx11::basic_string<char> >&, std::__cxx11::string&)’: src/template_match.cpp:54:66: error: no matching function for call to ‘Poco::ThreadPool::start(TemplateMatch::MatchTask*)’ match_pool.start(new MatchTask(stream_template[i], code_stream)); ^
这个错误是因为 `Poco::ThreadPool::start` 函数没有接受 `TemplateMatch::MatchTask*` 类型的参数。你可以尝试将其改为 `Poco::ThreadPool::start(std::unique_ptr<MatchTask>(new MatchTask(stream_template[i], code_stream)))`,这样可以通过 `std::unique_ptr` 来自动管理内存,避免内存泄漏问题。或者你也可以手动释放内存,即 `match_pool.start(new MatchTask(stream_template[i], code_stream)); delete new MatchTask(stream_template[i], code_stream);`。但是,这种方式容易出现内存泄漏问题,所以建议使用 `std::unique_ptr`。
error: no matching function for call to ‘std::vector<frameprocess_param>::push_back(int&)’
这个错误提示是因为你尝试将一个整数类型的值 `int&` 添加到 `std::vector<frameprocess_param>` 容器中,但是容器中存储的是 `frameprocess_param` 类型的对象,两者类型不一致,因此编译器无法匹配到对应的 `push_back` 函数。
你需要将整数类型的值转换为 `frameprocess_param` 类型的对象,然后再添加到容器中。例如:
```
int value = 10;
frameprocess_param param(value); // 假设有一个构造函数可以接受 int 类型的参数
std::vector<frameprocess_param> params;
params.push_back(param); // 将参数添加到容器中
```
或者你可以直接在 `push_back` 函数中创建 `frameprocess_param` 类型的对象:
```
int value = 10;
std::vector<frameprocess_param> params;
params.push_back(frameprocess_param(value)); // 创建对象并添加到容器中
```