【发布时间】:2013-07-30 00:58:18
【问题描述】:
我正在 QT 上使用 C++ (librairie OpenCV) 开发一个运行良好的 GUI。 现在我正在尝试使用 boost 对代码进行多线程处理 我的方法是:
//creating thread group
thread_group mythread;
//then creating threads
mythread.create_thread(bind(&MainWindow::setbarvalue,this,0) ) ;
//set max and min of a progressbar to zero to get a floatting progressbar
mythread.create_thread(bind(&AVI2Image::Convert_AVItoImage,&avitoim,Nom,firstframe, lastframe,Nom_save,digitsnumber)) ;
AVI2Image:类
Convert_AVItoImage:函数
avitoim:类的实例
然后是属性
这条线也可以。
问题从这一行开始:
mythread.create_thread(bind(&Lecture_containerYUV::container_YUV2yuv,&lectcont, Nom,Nom_save, width ,height,Redimonsionne,width_desir,height_desir, filter,inputsampling,
inputbitdepth,nbimages,digitsnumber,ry6,ru6,rv6,gy6,gu6,gv6,by6,bu6,bv6,coeff1,coeff2,coeff3,contrast,gamma,ry7,ru7,rv7,gy7,gu7,gv7,by7,bu7
,bv7,ry2,ru2,rv2,gy2,gu2,gv2,by2,bu2,bv2));
它与上面的方法相同,但在这里我得到了这个错误:
C:\Users\Mido\Documents\Container_ConverterV_2.4\mainwindow.cpp:363: erreur : no matching function for call to 'bind(void (Lecture_containerYUV::*)(std::string, std::string, int, int, bool, int, int, int, int, int, int, int, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double), Lecture_containerYUV*, std::string&, std::string&, int&, int&, bool&, int&, int&, int&, int&, int&, int&, int&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&)'
和:
lectcont.container_YUV2yuv( Nom,Nom_save, width ,height,Redimonsionne,width_desir,height_desir, filter,inputsampling,
inputbitdepth,nbimages,digitsnumber,ry6,ru6,rv6,gy6,gu6,gv6,by6,bu6,bv6,coeff1,coeff2,coeff3,contrast,gamma,ry7,ru7,rv7,gy7,gu7,gv7,by7,bu7
,bv7,ry2,ru2,rv2,gy2,gu2,gv2,by2,bu2,bv2);
工作正常!!!
mingw 找不到我不明白为什么的功能!
请帮忙
【问题讨论】:
-
我猜
container_YUV2yuv过载了,不是吗?如果是这样,bind无法自动选择正确的版本,您必须将container_YUV2yuv显式类型转换为适当的签名。 -
感谢您的评论,不,它没有超载!当我添加到 .pro 文件 -c++0x 时它已解决 :)
-
所以你真的试图打电话给
std::bind?显然,它仅在 c++11 中可用。我的印象是你的意思是boost::bind。 -
C++ 中没有任何“默认值”。函数名查找规则比较复杂:gotw.ca/gotw/030.htm
标签: c++ qt boost mingw boost-bind