Bug or Mistake??



  • 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????


  • Qt Champions 2017

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


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What compiler are you using ?

    Do you have a sample code that triggers this ?



  • 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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.