我在Visual Studio 2015项目的C ++类中使用了std :: thread。
class BaggageSoln {
void mainProcess();
// Threading functions
void run();
void startZED();
void closeZED();
private:
std::thread zed_callback;
}
void BaggageSoln::startZED()
{
// Start the thread for grabbing ZED data
has_data = false;
zed_callback = std::thread(&BaggageSoln::run);
//Wait for data to be grabbed
while (!has_data)
sleep_ms(1);
}
void BaggageSoln::mainProcess() {}
void BaggageSoln::run() {}
void BaggageSoln::closeZED(){}
第238行的xthread文件发生错误。 可能有什么不对?
答案 0 :(得分:3)
&BaggageSoln::run
需要调用实例,将其设为static
或提供实例。
zed_callback = std::thread(&BaggageSoln::run, this);