问题
I am having trouble compiling my code with QDebug, but i really need it.
#include <QCoreApplication>
#include <QtDebug>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QDebug() << "hello";
return a.exec();
}
This is an example of the error i got on this simple test: no matching function for call to 'QDebug::QDebug()'
回答1:
Try this:
qDebug() << "hello";
回答2:
The problem here is that QDebug does not have a default constructor. QDebug() << "hello";
would work if it did have one.
These are the available constructors:
QDebug(QIODevice* device);
QDebug(QString* string);
QDebug(QtMsgType type);
// and the copy constructor of course.
duDE's answer gives you what you're looking for.
来源:https://stackoverflow.com/questions/15364070/qt-5-0-qdebug-compilation-error