【发布时间】:2015-02-07 21:12:35
【问题描述】:
IDE 向我抱怨线程不包含我传递给它的参数数量。这是因为他们太多了,我相信......
我在使用线程标准库时遇到了同样的问题,但是对于兼容性问题,我需要使用 Boost::threads。 HERE 是我之前的问题的链接,有人解释说问题是由 veriadic 模板引起的。
这确实是问题所在,但是,在切换到 boost 线程后,该错误又回来了,更改 veriadic max 并不能解决它。
这是我的线程声明
boost::thread db(writeToDB, coordString, time, std::to_string(id), imageName, azimuth, att_pitch, att_roll, yaw, cam_pitch, cam_roll);
编辑:
这是我尝试绑定功能的方法:
boost::thread db(boost::bind(::writeToDB, coordString, time, std::to_string(id), imageName, azimuth, att_pitch, att_roll, yaw, cam_pitch, cam_roll));
目前的IDE是Visual Studio 2013,不过需要兼容Visual Studio 2008
这也是我收到的实际错误:
错误:
Error 6 error C2661: 'boost::thread::thread' : no overloaded function takes 11 arguments c:\users\hewittjc\desktop\final project\project1\clientexample.cpp 174 1 Project1
【问题讨论】:
-
一个简单的谷歌搜索给出了答案 - 重复 stackoverflow.com/questions/5730747/…
-
我试过bind函数,和thread一样报错
-
请告诉我们你是如何在线程构造函数中使用bind方法的?
-
什么是
The IDE?实际错误是什么? -
我已经在编辑中回答了上述问题。感谢您的关注!
标签: c++ multithreading boost