qDebug no output on CentOS

The qDebug()<<“aaaaa” is working perfectly on Windows, but when I compile the same program on CentOS, it suddenly stops working. I cannot see anything displayed on the console. Why qDebug shows nothing on CentOS? Is there any problem related to the programming environment?  I tested the printf function which can print messages without problem. So why does qDebug output nothing to the console? I added a “CONFIG+=console” line in the .pro file following the suggestion in this post,  then rebuilt the program. But the problem persisted and I saw nothing on the console. I finally solved this problem by adding an environment variable:

export QT_LOGGING_RULES="*.debug=true"

It turns out the qDebug uses a logging mechanism designed by CentOS then is restricted by the policy outside Qt. This is a bad programming habit. The program’s behavior is altered by something that is not clear outside your programming environment. This is also contradict to the autonomous philosophy in Linux. No doubt the designer of sysmctl is widely criticized by loyal developers of Linux.

Did you like this?
Tip admin with Cryptocurrency

Donate Bitcoin to admin

Scan to Donate Bitcoin to admin
Scan the QR code or copy the address below into your wallet to send some bitcoin:

Donate Bitcoin Cash to admin

Scan to Donate Bitcoin Cash to admin
Scan the QR code or copy the address below into your wallet to send bitcoin:

Donate Ethereum to admin

Scan to Donate Ethereum to admin
Scan the QR code or copy the address below into your wallet to send some Ether:

Donate Litecoin to admin

Scan to Donate Litecoin to admin
Scan the QR code or copy the address below into your wallet to send some Litecoin:

Donate Monero to admin

Scan to Donate Monero to admin
Scan the QR code or copy the address below into your wallet to send some Monero:

Donate ZCash to admin

Scan to Donate ZCash to admin
Scan the QR code or copy the address below into your wallet to send some ZCash:
Posted in

Leave a Reply