View Full Version : Debugging
Voldemort
9th May 2007, 21:13
Hello,
I don't understand the debugging in Qt. I wrote my own little debugging tool which writes my debug texts in a file in the homedir. But I saw there are also Qt debug tools. But where can I see the texts? In a file? Where is that file?
marcel
9th May 2007, 21:33
But I saw there are also Qt debug tools.
What tools are you referring to?
You can use qDebug to print messages on the debugger console.
Regards
I saw there are also Qt debug tools. But where can I see the texts? In a file? Where is that file?
By default qDebug() & friends output messages to "stderr", so all you have to do is to run your application from the console.
Voldemort
12th May 2007, 11:50
I mean qDebug:
http://doc.trolltech.com/snapshot/debug.html
Where do I find "stderr" or what is it?
wysota
12th May 2007, 13:02
stderr is the standard error file handler in C.
http://en.wikipedia.org/wiki/Standard_streams
Voldemort
12th May 2007, 15:44
1) I think they will be showed in the konsole window, is that correct?
2) Can I see it also in a file?
3) I guess you can put debug on/off, how do you do that?
wysota
12th May 2007, 16:19
1) I think they will be showed in the konsole window, is that correct?
Yes.
2) Can I see it also in a file?
Yes, if you redirect stderr (descriptor no "2") to some file:
./myapp 2> errors.log
3) I guess you can put debug on/off, how do you do that?
http://www.qtcentre.org/forum/f-qt-programming-2/t-disable-qdebug-output-3992.html
Please search the forum before asking such questions next time.
Voldemort
13th May 2007, 10:46
I've tested and I have 2 problems:
1) How do you put on/off the debugging in CMake?
2) When I restart my program, the file is emptied and the new text is written in the file. But I want to add the new text at the end of the file. How can I do this?
marcel
13th May 2007, 11:38
1. I think the answer is in your other post.
2. Use >> (append ) instead of > when you redirect the app outpout.
Regards
wysota
13th May 2007, 15:48
1) How do you put on/off the debugging in CMake?
The same way as everywhere - by defining a proper macro.
Voldemort
13th May 2007, 20:21
1. I think the answer is in your other post.
Which post?
2. Use >> (append ) instead of > when you redirect the app outpout.
Works fine.
The same way as everywhere - by defining a proper macro.
And what command has the macro to execute? Which arguments does it need?
wysota
13th May 2007, 21:03
And what command has the macro to execute? Which arguments does it need?
Did you read the thread I linked to where it's discussed how to turn off debugging output? You have to define a QT_NO_DEBUG_OUTPUT macro for your application! And please don't ask me how to define macros... (hint: "#define" or "-D" compiler option)
Voldemort
14th May 2007, 17:53
I try to compile it:
cmake ../QQMsn -DQT_NO_DEBUG_OUTPUT
Output:
Parse error in command line argument: -DQT_NO_DEBUG_OUTPUT
Should be: VAR:type=value
CMake Error: No cmake scrpt provided.
CMake Error: Problem processing arguments. Aborting.
But what is VAR, type and value? I only has a value (QT_NO_DEBUG_OUTPUT), what are the others?
jacek
14th May 2007, 21:38
But what is VAR, type and value? I only has a value (QT_NO_DEBUG_OUTPUT), what are the others?
Take a look at CMakeCache.txt file.
If you want to pass something to the compiler use ADD_DEFINITIONS() command in CMakeList.txt:
ADD_DEFINITIONS( -DQT_NO_DEBUG_OUTPUT )
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.