错误C2893无法专门化功能模板' unknown-type std :: invoke(_Callable&&,_ Types&& ...)'

时间:2017-06-13 10:01:40

标签: c++ multithreading visual-studio c++11 visual-studio-2015

我在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文件发生错误。 可能有什么不对?

1 个答案:

答案 0 :(得分:3)

&BaggageSoln::run需要调用实例,将其设为static或提供实例。

zed_callback = std::thread(&BaggageSoln::run, this);
相关问题