3
votes

I have built a QWidgets application in Qt 5.3.1 and in some places have used

qDebug() << msg;

where msg is a QString. I had had this compiling and running for a few years, but tonight I decided to recompile it and I got the message:

D:\devt\myapp\extcoder.cpp:29: error: no matching function for call to 'QMessageLogger::debug()'
 qDebug()<<msg;
        ^

In fact I got a similar problem in another app I wrote the other day, and by experimenting I thought I had fixed it by replacing such calls by qDebug(msg). But it looks as if some kind of software rot is setting in! Any ideas? Of course the file starts with

#include <QDebug>

To test this problem I built a barebones QWidgets application (of a QMainWindow kind), and the only code I wrote, was (apart from the #include)

qDebug()<<"Hello world";

in the MainWindow constructor. I get exactly the same compilation error.

3
what is your qt version?eyllanesc
I just edited my text: 5.3.1user1741137
Did you try to re-install Qt?x squared

3 Answers

1
votes

Reinstallation of Qt made qDebug()<<s work again.

It was indeed a kind of "software rot": I reinstalled qt 5.3.1 after making a copy of the original so I could compare the new with the old.

Using Winmerge I was able to uncover the error: I dont know exactly how it happened but the file qlogging.h got corrupted. Here's what happened: at lines 118 and 120 the declarations of two versions of debug got rewritten to NBIS_debug. Now I have worked trying to port free software from the NBIS. At some stage I must have renamed a debug function from debug to NBIS_debug, and this modification must have been propagated all the way to qlogging.h.

0
votes

QDebug &QDebug::operator<<(const QString &s) is supported in Qt.

Output example:

QString s;

s = "a";
qDebug().noquote() << s;    // prints: a
qDebug() << s;              // prints: "a"

Your Qt environment must be broken. Please, check your environment and re-install Qt if needed.

0
votes

I had to reinstall Ubuntu and Qt. The reinstall only Qt did not help.