I can’t create a thread (c ++ 11) inside a class method - every time a compilation error:
C: \ Qt \ Qt5.8.0_mingw \ Tools \ mingw530_32 \ i686-w64-mingw32 \ include \ c ++ \ functional: 1505: error: no type named 'type' in 'class std :: result_of (Values_Refresher_Class *, QTableWidget *, Values_Refresher_Class *)> 'typedef typename result_of <_Callable (_Args ...)> :: type result_type;
C: \ Qt \ Qt5.8.0_mingw \ Tools \ mingw530_32 \ i686-w64-mingw32 \ include \ c ++ \ functional: 1526: error: no type named 'type' in 'class std :: result_of (Values_Refresher_Class *, QTableWidget *, Values_Refresher_Class *)> '_M_invoke (_Index_tuple <_Indices ...>)
Here is the code:
#include <thread> // Функция запуска потока void Values_Refresher_Class::Start(QTableWidget *Table) { // Установить флаг работы потока To_Work = true; // Задать потоку функцию thread Refresher_Thread = thread(&Values_Refresher_Class::Refresher_Handler, Table, this); } // Функция обработчика потока void Values_Refresher_Class::Refresher_Handler(QTableWidget *Table) { // Пока установлен флаг работы потока while(To_Work) { // Обновить список переменных Refresh_Values(Table); // Остановить поток на Refresh_Delay QThread::sleep(Refresher_Delay); } } Climbed a bunch of forums and I just can’t understand what's the matter - if you create a stream in main, then everything works, but if you transfer the stream to a class, then everything stops working immediately. What can be wrong?
I work in QT Creator under MinGW. I use not Qt-shny flows, but standard, since I want to learn how to work with them
Refresher_Handler. And since the arguments seem confused,thisshould go first. - VTT