Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QXcbConnection: Could not connect to display

QXcbConnection: Could not connect to display

Scheduled Pinned Locked Moved Mobile and Embedded
6 Posts 3 Posters 6.4k 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.
  • C Offline
    C Offline
    chjatala
    wrote on last edited by
    #1

    Hi,

    I am trying to run my Qt program (named ROBOCRT) in ubuntu 14.04 through 'init.d' script. The program runs fine if I launch it from terminal. However, when I launch it through the 'init.d' script using 'sudo service ROBOCRT start', I get the following error message 'QXcbConnection: Could not connect to display' in a log file. I am working with Qt 5.3. Any hint how to resolve this problem.

    Kind regards
    chjatala

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andreyc
      wrote on last edited by
      #2

      Welcome to the Qt Dev Net!

      Do you use widgets in your app?
      If so then you will not be able to run your app without X11 and X11 is not started yet when the services are starting.

      What are trying to achieve ?

      1 Reply Last reply
      0
      • C Offline
        C Offline
        chjatala
        wrote on last edited by
        #3

        Thx.

        At the moment I am running the app after user login, not during system bootup. The app runs without error in the terminal.

        The app is based on 'Qt Widgets App', however, I disbaled the window display by commenting out 'w.show();' line in 'main.cpp'.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andreyc
          wrote on last edited by
          #4

          If you are using QApplication or QGuiApplication in the main() then your app will try to initialize graphics subsystem anyway.
          But without X11 it is not possible.

          You need to create a Qt Console application.

          1 Reply Last reply
          0
          • C Offline
            C Offline
            chjatala
            wrote on last edited by
            #5

            The problem is solved by the Console App. Thx.

            F 1 Reply Last reply
            0
            • C chjatala

              The problem is solved by the Console App. Thx.

              F Offline
              F Offline
              frdteknikelektro
              wrote on last edited by
              #6

              @chjatala can you please ellaborate your answer?thx

              1 Reply Last reply
              0

              • Login

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