【问题标题】:no stdint.h file on DebianDebian 上没有 stdint.h 文件
【发布时间】:2014-07-21 08:34:20
【问题描述】:

我正在尝试使用 Chibios。他们提供的示例代码似乎需要 stdint.h 文件。 Makefile 给出以下错误:

/usr/lib/gcc/arm-none-eabi/4.8/include/stdint.h:9:26: fatal error: stdint.h: No such file or directory
 # include_next <stdint.h>
                          ^
compilation terminated.
../../os/ports/GCC/ARMCMx/rules.mk:182: recipe for target 'build/obj/crt0.o' failed
make: *** [build/obj/crt0.o] Error 1

我在网络上找不到任何有用的东西。

【问题讨论】:

  • #include_next 是非标准的。你为什么尝试使用它而不是#include?
  • 我与该声明无关。 #include_next 位于 arm-none-eabi-gcc 软件包附带的 /usr/lib/gcc/arm-none-eabi/4.8/include/stdint.h 中。你要我编辑那个文件吗?
  • 对不起,我没有注意到。不,我不建议编辑该文件。我不知道为什么会使用#include_next

标签: c gcc arm embedded stm32


【解决方案1】:

#include_next 用于让一个文件增加另一个同名文件。在这种情况下,似乎“另一个”不可用。

我在尝试使用 Linux Mint 中的 gcc-arm 包 gcc-arm-none-eabi 编译我的代码时遇到了同样的错误。我通过安装 libnewlib-arm-none-eabi 解决了这个问题:sudo apt-get install libnewlib-arm-none-eabi

【讨论】:

  • 在 fedora/etc 上使用 arm-none-eabi-newlib
  • Arch 上也有 arm-none-eabi-newlib
【解决方案2】:

试试这个:

apt-get install avr-libc

嗯,我的回答不适合ARM,只是希望其他avr用户遇到同样的问题时能得到帮助。

【讨论】:

  • 这有什么帮助?目标显然是 ARM / STM32,而不是 AVR。
  • 问题不是stdint.h,我只是用谷歌搜索了其中包含的avr-libc。它适用于我的小项目。
  • 但是 stdint.h 是特定于体系结构的,8 位 AVR 不适合与 32 位 ARM 一起使用。问题被清楚地标记,正文清楚地表明正在使用的工具链。这里的解决方案是正确安装正确的工具链,不是这样的。
  • @Clifford,感谢您的更正。我只是在这里找到 stdint.h:nongnu.org/avr-libc/user-manual/group__avr__stdint.html。您可以与第一臂进行比较。
【解决方案3】:

在 gcc-arm-embedded 团队 (here) 的宝贵帮助下,我成功编译了 Chibios 演示程序。我从他们的启动板站点下载了 gcc-arm-none-eabi-4_8-2014q1,它工作得很好。

【讨论】:

  • apt-get install libc6-dev 是我的解决方案。谢谢
【解决方案4】:

可能你忘了指定 gcc 的-ffreestanding 选项。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-07-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多