【发布时间】:2014-08-07 05:54:19
【问题描述】:
我在 VS13 中写多个线程
函数声明:
void getColorImage(HANDLE &colorEvent, HANDLE &colorStreamHandle, Mat &colorImage);
void getDepthImage(HANDLE &depthEvent, HANDLE &depthStreamHandle, Mat &depthImage);
void getSkeletonImage(HANDLE &skeletonEvent, Mat &skeletonImage, Mat &colorImage, Mat &depthImage, ofstream& myfile);
int main()
{
// this is inside a while loop
std::thread first(getColorImage, colorEvent, colorStreamHandle, colorImage);
std::thread second(getDepthImage, depthEvent, depthStreamHandle, depthImage);
std::thread third(getSkeletonImage, skeletonEvent, skeletonImage, colorImage, depthImage, myfile);
first.join();
second.join();
third.join();
}
但是,我收到一个错误:
错误 1 错误 C2280: 'std::basic_ofstream>::basic_ofstream(const std::basic_ofstream> &)' : 试图引用已删除的函数 c:\program files (x86)\microsoft visual studio 12.0\vc\包括\type_traits 1545 1 Skeleton_RGBDepth_DataAcquisition2013
不知道为什么...有人可以帮忙吗?
【问题讨论】:
-
使用
std::ref(myfile)而不仅仅是myfile。
标签: c++ multithreading c++11