Results 1 to 4 of 4

Thread: qDebug() and long long int on WIN

  1. #1
    Join Date
    Dec 2010
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Unhappy qDebug() and long long int on WIN

    Hi all

    I'm in trouble trying to print a long long int with qDebug...
    it works fine on linux but on windows 7 + mingw "%lld" is not recognized and "%I64d" crash the application ...

    anyone else is having this issue ?

    thanks in advance for any hints

    Giampaolo

    BTW using printf("%I64d") instead of qDebug("%I64d") works.

  2. #2
    Join Date
    Jul 2010
    Posts
    53
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qDebug() and long long int on WIN

    why not use qDebug this way:
    Qt Code:
    1. qDebug() << qint64(0x7FFFFFFFFFFFFFFF);
    To copy to clipboard, switch view to plain text mode 
    ???

  3. #3
    Join Date
    Dec 2010
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: qDebug() and long long int on WIN

    hi

    this works... thanks

    anyway... I was hoping qDebug() to be more portable... as streaming format insert spaces between items, auto cr/lf at the end etc etc...

    Best Regards

    Giampaolo

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: qDebug() and long long int on WIN

    Ultimately the qDebug(const char *fmt, ...) uses QString::sprintf():
    The format string supports most of the conversion specifiers provided by printf() in the standard C++ library. It doesn't honor the length modifiers (e.g. h for short, ll for long long). If you need those, use the standard snprintf() function instead...
    Also see: bug report

    You can suppress spaces in the streamed version:
    Qt Code:
    1. qDebug() << "1" << "2" << "3";
    2. qDebug().nospace() << "1" << "2" << "3";
    To copy to clipboard, switch view to plain text mode 
    QDebug is a debugging aid, not a pretty printer, but nothing stops you using QString and QString::arg() to build more complex output.

Similar Threads

  1. long query executing
    By banita in forum Qt Programming
    Replies: 11
    Last Post: 11th October 2010, 00:38
  2. Very very long Plot
    By BobTheProg in forum Qwt
    Replies: 2
    Last Post: 27th January 2010, 17:02
  3. buton text long ?
    By electronicboy in forum General Programming
    Replies: 3
    Last Post: 2nd November 2009, 10:21
  4. Best way to abort long SQL query?
    By wdezell in forum Newbie
    Replies: 1
    Last Post: 11th September 2009, 22:05
  5. what to do during long calculation?
    By Weilor in forum Qt Programming
    Replies: 4
    Last Post: 14th September 2007, 12:11

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.