0

我有一个用 C++ 1996 编写的程序,我想将它编译为 C++ 17。添加 #include 时收到一条错误消息,我被称为 cstdint。这缺少以下声明:

/ usr / include / c ++ / 8 / cstdint: 51: 11: error: ":: int64_t" has not been declared
   using :: int64_t;
           ^ ~~~~~~
/ usr / include / c ++ / 8 / cstdint: 53: 11: error: ":: int_fast8_t" has not been declared
   using :: int_fast8_t;
           ^ ~~~~~~~~~~
In file included from /usr/include/c++/8/bits/char_traits.h:503,
                 from / usr / include / c ++ / 8 / string: 40,
/ usr / include / c ++ / 8 / cstdint: 53: 11: error: ":: int_fast8_t" has not been declared
   using :: int_fast8_t;
           ^ ~~~~~~~~~~
/ usr / include / c ++ / 8 / cstdint: 54: 11: error: ":: int_fast16_t" has not been declared
   using :: int_fast16_t;
           ^ ~~~~~~~~~~~
/ usr / include / c ++ / 8 / cstdint: 55: 11: error: ":: int_fast32_t" has not been declared
   using :: int_fast32_t;
           ^ ~~~~~~~~~~~
/ usr / include / c ++ / 8 / cstdint: 56: 11: error: ":: int_fast64_t" has not been declared
   using :: int_fast64_t;
           ^ ~~~~~~~~~~~
/ usr / include / c ++ / 8 / cstdint: 58: 11: error: ":: int_least8_t" has not been declared
   using :: int_least8_t;
           ^ ~~~~~~~~~~~
/ usr / include / c ++ / 8 / cstdint: 59: 11: error: ":: int_least16_t" has not been declared
   using :: int_least16_t;
           ^ ~~~~~~~~~~~~
/ usr / include / c ++ / 8 / cstdint: 60: 11: error: ":: int_least32_t" has not been declared
   using :: int_least32_t;
           ^ ~~~~~~~~~~~~
/ usr / include / c ++ / 8 / cstdint: 61: 11: error: ":: int_least64_t" has not been declared
   using :: int_least64_t;
           ^ ~~~~~~~~~~~~
/ usr / include / c ++ / 8 / cstdint: 63: 11: error: ":: intmax_t" has not been declared
   using :: intmax_t;
           ^ ~~~~~~~
/ usr / include / c ++ / 8 / cstdint: 71: 11: error: ":: uint_fast8_t" has not been declared
   using :: uint_fast8_t;
           ^ ~~~~~~~~~~~
/ usr / include / c ++ / 8 / cstdint: 72: 11: error: ":: uint_fast16_t" has not been declared
   using :: uint_fast16_t;
           ^ ~~~~~~~~~~~~
/ usr / include / c ++ / 8 / cstdint: 73: 11: error: ":: uint_fast32_t" has not been declared
   using :: uint_fast32_t;
           ^ ~~~~~~~~~~~~
/ usr / include / c ++ / 8 / cstdint: 74: 11: error: ":: uint_fast64_t" has not been declared
   using :: uint_fast64_t;
           ^ ~~~~~~~~~~~~
/ usr / include / c ++ / 8 / cstdint: 76: 11: error: ":: uint_least8_t" has not been declared
   using :: uint_least8_t;
           ^ ~~~~~~~~~~~~
/ usr / include / c ++ / 8 / cstdint: 77: 11: error: ":: uint_least16_t" has not been declared

如果我用 c++ 98 编译程序,我没有问题。

以前有没有人遇到过,或者您知道解决方案吗?

问候安德烈

4

1 回答 1

0

解决了我的程序,并很高兴分享它。经过大量搜索,我偶然发现了CSTDINT / STRING问题的原因。

在#INCLUDE STRING 中调用#INCLUDE CSTDINT 函数,在#INCLUDE CSTDINT 中调用#INCLUDE STDINT.H。现在我的程序中还有一个 stdint.h,编译器中也有一个,这就产生了问题。

如何解决。在程序中找到stdint.h文件,将其删除。这就是所有人

于 2020-02-10T12:32:35.850 回答