Important: Please read the Qt Code of Conduct -

QXcbConnection could not connt to display, cygwin

  • Hello everyone,

    I am using the newest release of cygwin on Windows 10 CLion (aka CMake build system) using the Qt5 version shipped with the newest version of cygwin. Everything works great including moc and etc but as soon as I am trying to run the Program it crashes at the first line which is a call to the default QApplication constructor. The error message in the console is:

    QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-User'
    qt.qpa.screen: QXcbConnection: Could not connect to display
    Could not connect to any X display.

    Thanks in Advance!

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    AFAIK you have to start an X server before you can run such an application with Cygwin.

  • I am not quite sure if I am doing it right, but I started the X server using startxwin inside of the Cygwin terminal and then exported the Display with export DISPLAY=0.0, but starting the Qt application afterwards resulted in the same error. I am sorry that I am quite new to this!

  • Lifetime Qt Champion

    IIRC, it should be DISPLAY=:0.0

  • Lifetime Qt Champion

    Just as note.
    You should do it in same shell
    (start x server)
    export DISPLAY=:0.0; /path/app

Log in to reply