#include #include int main(int argc, char *argv[]) { auto gui_wapper = []{ int nope = 0; QApplication a(nope, nullptr); QMetaObject::invokeMethod(&a, "quit", Qt::QueuedConnection); return a.exec(); }; std::thread t1(gui_wapper); t1.join();//no spurious warnings, everything works as expected std::thread t2(gui_wapper); t2.join();//spurious warning, makes me look silly return 0; }