NS-3 - NetAnim error: qt.qpa.xcb: could not connect to display localhost:0.0
Got it solved!
What I did is:
- Enabled Virtualization in BIOS.
- Reset the WSL.
- Upgraded WSL1 to WSL2.
- Set WSL: 2 as default, <deb_pack>: 2 default.
Using WSL2 doesn't really make fuss with Qt.
Qt: launch a message box periodically with crontab in ubuntu
I think the DISPLAY environment is missing. I suggest you wrap your application in a wrapper script (let's call it horloge.sh):
#!/bin/sh
DISPLAY=:0
export DISPLAY
/home/salwa/computing/cpp/horloge
Then put the horloge.sh in your crontab. Don't forget to do a chmod u+x horloge.sh
so that the script is executable.
QXcbConnection: Could not connect to display, when remotely debugging program with Qt5
When you deploy your application and run it from within the X11 system on device itself, you're finding it works because here it has access to the DISPLAY
environment variable which (briefly put) tells it where to display itself. This environment variable has been set further up the process tree in your X session.
When you launch a program via the debugger, Qt Creator is connecting to the remote device (via your settings in Tools > Options > Devices), and running the program via ssh. In this context your program no longer knows where to display itself, as obviously it can't display in ssh. It faults on the line you indicated because this is where the XCB subsystem is trying to determine which X-Server to connect to for this purpose.
So to answer your question: you need to manually provide the DISPLAY
environment variable when remote debugging.
An easy way to test this is to go to Projects Mode, find the kit you are using to build for the remote device, and select the Run settings. Under this, you should find an Run Environment section. Here you can add a new variable called DISPLAY
and set its value to the identifier of the display you are running on (I'm guessing you'll want :0.0
, indicating the first available screen on localhost, although you should read about the DISPLAY variable e.g. here or here).
A longer-term, potentially better solution would be to set the same variable in the settings of your Kit (Tools > Options > Build & Run > Kits > Environment). This will then apply for future programs you create using this.
Related Topics
Jetty Bash Script Works Only with Root User
How to Find Which Type of System Call Is Used by a Program
Raising Hard Limit on Rlimit_Nofile System-Wide on Linux
Take The Last Part of The Folder Path in Shell
Linux Script with Netcat Stops Working After X Hours
Vimdiff: How to Put All Changes Inside a Particular Function from One File to Another
Change The Default Find-Grep Command in Emacs
Sending from The Same Udp Socket in Multiple Threads
Using Multiple Layers of Quotes in Bash
Write and Read from Ttyusb0, Can't Get Response
Compilation Gcc 4.6.2 (Cannot Compute Suffix of Object Files)
Why Doesn't Time() from Time.H Have a Syscall to Sys_Time