使用 2 个参数函数构造 std::thread 时出错

Error while constructing std::thread using 2 argumented function

我正在使用 SFML 创建一个简单的游戏,但我遇到了这个错误:

"std::invoke()": no matching overloaded function found

Failed to specialize function template 'unknown-type std::invoke(_Callable &&,_Types &&...)'

同时使用以下代码:

线程函数:

void  drawing(charact Hero, sf::RenderWindow window) {
while (window.isOpen()) {
    window.clear();
    window.draw(Hero.hitBox);
    window.display();
    }
}

线程声明:

std::thread Draw(drawing, Hero, window);

sf::RenderWindow 不可复制(由于继承了 sf::NonCopyable),因此 drawing 不能按原样调用。添加引用或使用(智能)指针。