Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Why do I get a thread error?
QtWS25 Last Chance

Why do I get a thread error?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 682 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    minseokle
    wrote on last edited by
    #1

    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?

    Christian EhrlicherC 1 Reply Last reply
    0
    • M minseokle

      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?

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • M Offline
        M Offline
        minseokle
        wrote on last edited by
        #3

        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();
        }
        
        jsulmJ 1 Reply Last reply
        0
        • M minseokle

          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();
          }
          
          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @minseokle How did you install Qt?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          M 1 Reply Last reply
          0
          • jsulmJ jsulm

            @minseokle How did you install Qt?

            M Offline
            M Offline
            minseokle
            wrote on last edited by
            #5

            @jsulm 저는 ros를 설치하면서 같이 설치된 qt5와 직접 다음명령어를 통해 설치한 qtcreator를 사용하고 있습니다.

            sudo apt install qtcreator
            
            Pl45m4P 1 Reply Last reply
            0
            • M minseokle

              @jsulm 저는 ros를 설치하면서 같이 설치된 qt5와 직접 다음명령어를 통해 설치한 qtcreator를 사용하고 있습니다.

              sudo apt install qtcreator
              
              Pl45m4P Offline
              Pl45m4P Offline
              Pl45m4
              wrote on last edited by Pl45m4
              #6

              @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).


              If debugging is the process of removing software bugs, then programming must be the process of putting them in.

              ~E. W. Dijkstra

              1 Reply Last reply
              1

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved