QtCreator + MSVC 2015: Compilation error



  • There's a library to be used in Qt Project. When attempting to connect it, a compilation error occurs:

    error C2371: 'int32_t': redefinition; different basic types
     D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\stdint.h(19): note: see declaration of 'int32_t'
    

    That's the definition in the hider:

    #ifndef __int32_t_defined
    #define __int32_t_defined
    /**
    * \brief 32 bit signed integer
    */
    #ifdef _WIN32
    Ошибка здесь ---> typedef long int32_t;
    #else
    typedef int int32_t;
    #endif
    #endif
    /*@}*/
    

    Stdint.h finds the following:

    typedef int   int32_t;
    

    If compiling a test example without using Qt, there is no such error. I guess it's about some keys, what's the question?



  • Try adding a headline stdint.h as above as possible before the headline files Qt are activated. After insert:

    #define __int32_t_defined
    

    In this case, the protection against re-engineering and int32_t will not be determined twice.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2