Please don't post to serious mailing lists with colors, backgrounds, HTML formatting, and ESPECIALLY unsolicited and unnecessary attachments.
/s/ Adam On Mon, Jul 25, 2011 at 11:38 PM, jason.heblack <[email protected]> wrote: > > Andy, > I would like to know how to jump directly to the file:line too in Qt-creator > of course. > > I am on gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4) and have got a > simple 'rough draft' of a debug function put together that works for me to > print out the correct line number, file, and function: > > QDebug debug(void* bugfix,...) > { //***Prints out line, file, function and gives back a QDebug > //the args must be: > //NULL,__LINE__,__FILE__,__FUNCTION__ > //the 'bugfix' arg (for example NULL) must be included OR GCC error: > 'va_start' used in function with fixed args > va_list valist; > va_start(valist,bugfix); > int line=va_arg(valist,int); > char* file=va_arg(valist,char*); > char* function=va_arg(valist,char*); > va_end(valist); > return > qDebug()<<line<<QString().append(file).append("__").append(function).append(":").toStdString().c_str(); > } > > Like I said, it prints out the line number, file, and function but only by > including something like this in your App: > debug(NULL,__LINE__,__FILE__,__FUNCTION__) << "hello andy"; > > The link to GCC MACROS (__LINE__,__FILE__,__FUNCTION__) is here: > http://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html#Standard-Predefined-Macros > > I didn't want the function prototype to look like that but it was all I could > do. Is there a better idea? > > Regards, > Jason > > On 07/25/2011 03:25 PM, andy fillebrown wrote: > > Hi all, > > I'm trying to print qWarning() messages such that a file and line link is > included, similar to how QObject::connect does it when it reports a > bad connection attempt ... > > [SNIP] > -- > > > > _______________________________________________ > Qt-creator mailing list > [email protected] > http://lists.qt.nokia.com/mailman/listinfo/qt-creator > _______________________________________________ Qt-creator mailing list [email protected] http://lists.qt.nokia.com/mailman/listinfo/qt-creator
