'uint32_t' does not name a type

后端 未结 9 1728
旧时难觅i
旧时难觅i 2021-01-30 12:13

I\'m trying to compile a C++ software package that was written in 2007 and I\'m getting this error:

error: ‘uint32_t’ does not name a type

This is h

9条回答
  •  半阙折子戏
    2021-01-30 13:09

    The other answers assume that your compiler is C++11 compliant. That is fine if it is. But what if you are using an older compiler?

    I picked up the following hack somewhere on the net. It works well enough for me:

      #if defined __UINT32_MAX__ or UINT32_MAX
      #include 
      #else
      typedef unsigned char uint8_t;
      typedef unsigned short uint16_t;
      typedef unsigned long uint32_t;
      typedef unsigned long long uint64_t;
      #endif
    

    It is not portable, of course. But it might work for your compiler.

提交回复
热议问题