我在 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(){}
xthread 文件第 238 行发生错误。 有什么问题吗?
最佳答案
&BaggageSoln::run
需要调用一个实例,将其设为static
或提供一个实例。
zed_callback = std::thread(&BaggageSoln::run, this);
关于c++ - 错误 C2893 函数模板专用化失败 'unknown-type std::invoke(_Callable &&,_Types &&...)',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44518253/