Qt apps with VC + + 2008 Express to debug
Published on| May 11th, 2009 | No Comment.
Categories:Qt |
Description:
About Qt preferences, recently wrote the article. (See related article above)
So, to some extent, VC + + with Qt SOROIMASHITA development to the environment. So, will actually create a Qt application, the first question is, do you want to debug? I would think. In fact, until now for programmers who have created a MFC application and the level of environmental否MEMASEN down. And in creating applications using MFC, the APURIKESHONUIZADO It has, accordingly, SURURE create a template, you need to debug macros in the template that is to some extent, they are embedded. (Unfortunately Qt, you must fill in KOMANAKERE itself. )
And also say, MFC you have experience of, well if you add a macro name that is familiar to quite a memory leak, MFC and Win32 normal memory leak tests are used in applications unusable.
Around the area, which is what I try and write.
Related Articles: VC + + 2008 Express and using the sample compiled Qt Preferences
Related Articles: qmake in VC + + 2008 Express to create a project file
Reference article: Debugging Techniques
Sample source code you used here:
Qt's debug macros and output message
Qt macro for debugging output and the message may include the following.
| Macro name | Features |
| Q_ASSERT (cond): (* 1) | cond is a boolean value (and judging).
cnnd FALSE if the output of the following warning:
"ASSERT: 'cnnd' in file xyz.cpp (234) " |
| Q_ASSERT_X (cond, where, what): (* 1) | cond is the same as above.
where the output "and where" information.
what is the output to "what" information.
Output the following warning:
"ASSERT failure in where: 'what', file xyz.cpp, line 234 " |
| Q_CHECK_PTR (ptr): (* 1) | ptr is a pointer.
If ptr is null, then output the following warning:
"In file xyz.cpp, line 234: Out of memory " |
| qDebug (): (* 2) | Displays the output for debugging and testing. |
| qWarning (): (* 3) | Outputs a warning when the error occurred in the program. |
| qCritical () | Critical error (system error) occurs when the error message output. |
| qFatal (): | Quit fatal error message output. |
The above macro MFC Qt equivalent to write the following macro name.
| Qt macro name | MFC macro name |
| Q_ASSERT (cond): (* 1) | ASSERT (cond) |
| Q_ASSERT_X (cond, where, what): (* 1) | ASSERT (cond) + TRACE () |
| Q_CHECK_PTR (ptr): (* 1) | ASSERT_VALID (pOb) or ASSERT_POINTER (p, type) |
| qDebug (): (* 2) | TRACE () or AfxDump () |
| qWarning (): (* 3) | TRACE () or AfxDump () or fprinf (error) |
| qCritical () | TRACE () or AfxDump () or FormatMessage? or fprinf (error) |
| qFatal (): | TRACE () + FatalExit / FatalAppExit |
* 1: QT_NO_DEBUG if defined (Release Version, etc.), do nothing.
* 2: QT_NO_DEBUG_OUTPUT if defined (Release Version, etc.), do nothing.
* 3: QT_NO_DEBUG_OUTPUT and QT_NO_WARNING_OUTPUT if defined (Release Version, etc.), do nothing.
The output for each message, # include < QDebug> Can be described as follows to include the.
※ normal message output, printf is the same argument.
1 | qDebug() << "Debug << " << &hello << "Position:" << hello.pos(); |
Destination of the message, VC + +, running in debug, debug console (debugging output on the screen) to be output, MFC is the same.
Previous article "VC + + 2008 Express using the Qt compilation and sample preferences" sample.cpp used in the output and try to actually use the debugging information.
You might also like:
Trackback URL
After Admin approves this comment, it will be shown.
Comments
Leave a Reply
