Results 1 to 14 of 14

Thread: Debugging

  1. #1
    Join Date
    May 2007
    Posts
    37
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Debugging

    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?
    Using Qt version 4.3.0

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Debugging

    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

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Debugging

    Quote Originally Posted by Voldemort View Post
    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.

  4. #4
    Join Date
    May 2007
    Posts
    37
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Debugging

    I mean qDebug:
    http://doc.trolltech.com/snapshot/debug.html

    Where do I find "stderr" or what is it?
    Last edited by Voldemort; 12th May 2007 at 11:02.
    Using Qt version 4.3.0

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,014 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Debugging

    stderr is the standard error file handler in C.

    http://en.wikipedia.org/wiki/Standard_streams

  6. #6
    Join Date
    May 2007
    Posts
    37
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Debugging

    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?
    Using Qt version 4.3.0

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,014 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Debugging

    Quote Originally Posted by Voldemort View Post
    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-p...tput-3992.html

    Please search the forum before asking such questions next time.

  8. #8
    Join Date
    May 2007
    Posts
    37
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Debugging

    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?
    Using Qt version 4.3.0

  9. #9
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Debugging

    1. I think the answer is in your other post.
    2. Use >> (append ) instead of > when you redirect the app outpout.

    Regards

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,014 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Debugging

    Quote Originally Posted by Voldemort View Post
    1) How do you put on/off the debugging in CMake?
    The same way as everywhere - by defining a proper macro.

  11. #11
    Join Date
    May 2007
    Posts
    37
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Debugging

    Quote Originally Posted by marcel View Post
    1. I think the answer is in your other post.
    Which post?

    Quote Originally Posted by marcel View Post
    2. Use >> (append ) instead of > when you redirect the app outpout.
    Works fine.

    Quote Originally Posted by wysota View Post
    The same way as everywhere - by defining a proper macro.
    And what command has the macro to execute? Which arguments does it need?
    Using Qt version 4.3.0

  12. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,014 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Debugging

    Quote Originally Posted by Voldemort View Post
    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)

  13. #13
    Join Date
    May 2007
    Posts
    37
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Debugging

    I try to compile it:

    Qt Code:
    1. cmake ../QQMsn -DQT_NO_DEBUG_OUTPUT
    To copy to clipboard, switch view to plain text mode 

    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?
    Using Qt version 4.3.0

  14. #14
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Debugging

    Quote Originally Posted by Voldemort View Post
    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 )

Similar Threads

  1. Debugging plugins
    By KShots in forum Qt Programming
    Replies: 1
    Last Post: 29th April 2007, 22:20
  2. Macro used for debugging
    By sunil.thaha in forum General Programming
    Replies: 11
    Last Post: 30th March 2007, 17:32
  3. Debugging on Mac
    By rickbsgu in forum Qt Programming
    Replies: 3
    Last Post: 13th October 2006, 13:12
  4. problem with gdb debugging
    By bruce1007 in forum General Discussion
    Replies: 1
    Last Post: 3rd August 2006, 13:37
  5. Qt debugging
    By Morea in forum Newbie
    Replies: 4
    Last Post: 24th March 2006, 18:28

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.