Why do I get a thread error?
-
I'm using Ubuntu 24.04.
For basic testing, I created and ran a qt widgets application in qtcreator, but the following error occurred.QSocketNotifier: Can only be used with threads started with QThread
How can I solve it?
@minseokle said in Why do I get a thread error?:
How can I solve it?
By not creating a QSocketNotifier in one thread and use it in another.
What exact Qt version do you use and please show a minimal, compilable example. -
Error when building in qt5 version.
The above problem occurs only by using this code.
#include <QApplication> #include <iostream> // #include "mainwindow.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); // MainWindow w; // w.show(); return a.exec(); }
-
Error when building in qt5 version.
The above problem occurs only by using this code.
#include <QApplication> #include <iostream> // #include "mainwindow.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); // MainWindow w; // w.show(); return a.exec(); }
@minseokle How did you install Qt?
-
@minseokle How did you install Qt?
-
@jsulm 저는 ros를 설치하면서 같이 설치된 qt5와 직접 다음명령어를 통해 설치한 qtcreator를 사용하고 있습니다.
sudo apt install qtcreator
@minseokle said in Why do I get a thread error?:
저는 ros를 설치하면서 같이 설치된 qt5와 직접 다음명령어를 통해 설치한 qtcreator를 사용하고 있습니다.
sudo apt install qtcreator
Translates to:
I'm using QT5, which was installed with ROS, and QTCreator, which I installed directly with the following command.
sudo apt install qtcreator
Are you using Ubuntu 24.04 with the Wayland window manager by any chance?
It might be the case that the Qt5 version that comes with ROS (really ROS, not even ROS2?!) does not support Wayland properly (because too old).