PDA

View Full Version : how to print filename and linenumber using qDebug



dpatel
24th May 2010, 10:42
I am using qDebug to print debug messages. I have created customMessageHandler() which I install by calling qInstallMsgHandler() before calling qDebug. Now I want to display the filename and linenumber from which qDebug gets called. How can I do that?

Regards

tbscope
24th May 2010, 11:49
Try this:
http://doc.qt.nokia.com/4.6/qtglobal.html#Q_FUNC_INFO

dpatel
24th May 2010, 12:21
I don't get line number of the file, may be its compiler dependent, since the description says so. Thanks

Lykurg
24th May 2010, 12:36
Try if
qWarning() << __FILE__ << __LINE__;works for you.