Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Bug or Mistake??

Bug or Mistake??

Scheduled Pinned Locked Moved Unsolved C++ Gurus
4 Posts 3 Posters 1.9k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • phirusP Offline
    phirusP Offline
    phirus
    wrote on last edited by
    #1

    Hi!!!!

    I'm working in a code that use Qt libraries to manipulate some images. The problem is that I have an error compiling my code when is including the headers of Qt. But this error appear when I use gcc version 5.X. If I used gcc version 4.8 all is fine

    The error ....

    /opt/Qt/5.6/include/QtCore/qlogging.h:90:44: error: format string argument is not a string type
         void debug(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
                                                ^
    /opt/Qt/5.6/include/QtCore/qlogging.h:91:43: error: format string argument is not a string type
         void noDebug(const char *, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3)
    
    

    To solve I have to modify the header of qt "src/qtbase/src/corelib/global/qglobal.h" commenting this lines

    // enable gcc warnings for printf-style functions
    /*#if defined(Q_CC_GNU) && !defined(__INSURE__)
    #  if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG)
    #    define Q_ATTRIBUTE_FORMAT_PRINTF(A, B)             \
             __attribute__((format(gnu_printf, (A), (B))))
    #  else
    #    define Q_ATTRIBUTE_FORMAT_PRINTF(A, B)             \
             __attribute__((format(printf, (A), (B))))
    #  endif
    #else*/
    #  define Q_ATTRIBUTE_FORMAT_PRINTF(A, B)
    //#endif
    

    What am I doing wrong????

    kshegunovK 1 Reply Last reply
    0
    • phirusP phirus

      Hi!!!!

      I'm working in a code that use Qt libraries to manipulate some images. The problem is that I have an error compiling my code when is including the headers of Qt. But this error appear when I use gcc version 5.X. If I used gcc version 4.8 all is fine

      The error ....

      /opt/Qt/5.6/include/QtCore/qlogging.h:90:44: error: format string argument is not a string type
           void debug(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
                                                  ^
      /opt/Qt/5.6/include/QtCore/qlogging.h:91:43: error: format string argument is not a string type
           void noDebug(const char *, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3)
      
      

      To solve I have to modify the header of qt "src/qtbase/src/corelib/global/qglobal.h" commenting this lines

      // enable gcc warnings for printf-style functions
      /*#if defined(Q_CC_GNU) && !defined(__INSURE__)
      #  if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG)
      #    define Q_ATTRIBUTE_FORMAT_PRINTF(A, B)             \
               __attribute__((format(gnu_printf, (A), (B))))
      #  else
      #    define Q_ATTRIBUTE_FORMAT_PRINTF(A, B)             \
               __attribute__((format(printf, (A), (B))))
      #  endif
      #else*/
      #  define Q_ATTRIBUTE_FORMAT_PRINTF(A, B)
      //#endif
      

      What am I doing wrong????

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      @phirus
      Why is this header included at all? I work with g++ 5.x and haven't seen any such errors.

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi and welcome to devnet,

        What compiler are you using ?

        Do you have a sample code that triggers this ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • phirusP Offline
          phirusP Offline
          phirus
          wrote on last edited by
          #4

          For example I have this code... nothing weird

          #ifndef PARTICLE_H_
          #define PARTICLE_H_
          
          #include <QVector3D>
          #include "global.h"
          ....
          namespace xpore
          {
          
           void integrate( const Node<Model> & node, const QVector3D& refVel, const Config &config )
            {
              Real rvx = ( refVel.x()-vx );
              Real rvy = ( refVel.y()-vy );
              Real rvz = ( refVel.z()-vz );
          ...
          }
          }
          
          

          I'm using gcc 5.3 compiled by me. Also I have tried with gcc 5.2

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved