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);
这个错误提示表明在你的代码中调用了一个不存在的函数。具体来说,这个函数是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
。
D:\ZBY\ZBYQT\VarTst\main.cpp:71: error: no matching function for call to 'PolynomialRegression::dot(std::vector<double>&, __gnu_cxx::__alloc_traits<std::allocator<std::vector<double> > >::value_type&)' numerator += weight * y[i] * dot(x_poly, X_poly[i]); ^
这个错误信息是针对 C++ 代码的,看起来是在调用 PolynomialRegression
类的 dot()
方法时出错了。该方法需要传入一个 std::vector<double>
类型的向量和一个 __gnu_cxx::__alloc_traits<std::allocator<std::vector<double> > >::value_type&
类型的参数,但是你传入的参数类型不匹配,导致编译器找不到匹配的函数。
你可以检查一下你的代码,看看是否有传参错误或者参数类型不匹配的地方。如果还有问题,建议贴出相关代码,方便更好地定位问题。
相关推荐













