c++ - 构建失败 arm-none-eabi-gcc
问题描述
我进入了《Beginning STM32》一书——Warren Gay。我尝试在 Cygwin 下构建源代码,但即使在 makefile 中指出了所需文件的路径,也找不到所需文件。文件夹libopencm3/cm3/scb.h中的文件位于路径中:/home /root/STM32/stm32f103c8t6/libopencm3/include所以正确的路径应该是/home/root/STM32/stm32f103c8t6/libopencm3/include/libopencm3/cm3/scb.h我检查了文件的存在。
所以我尝试在源文件夹中使用所需的头文件将#include 更改为#include "file.h" - 这很有效,但是在不同的源文件中有很多情况。
有什么建议可以解决这个问题或找到摆脱这个问题的方法吗?
非常感谢!
这是我从终端得到的。
[~/STM32/stm32f103c8t6]
$ make
make -C rtos/libwwg
make[1]: Entering directory '/home/root/STM32/stm32f103c8t6/rtos/libwwg'
make -w -C ./src
make[2]: Entering directory '/home/root/STM32/stm32f103c8t6/rtos/libwwg/src'
arm-none-eabi-gcc -Os -g -std=c99 -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -I/home/root/STM32/stm32f103c8t6/libopencm3/include -I/home/root/STM32/stm32f103c8t6//rtos/libwwg/include -I./rtos -I. -MD -Wall -Wundef -DSTM32F1 -I/home/root/STM32/stm32f103c8t6/libopencm3/include -I/home/root/STM32/stm32f103c8t6//rtos/libwwg/include -o usbcdc.o -c usbcdc.c
usbcdc.c:7:10: fatal error: libopencm3/cm3/scb.h: No such file or directory
7 | #include <libopencm3/cm3/scb.h>
| ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [../../../Makefile.incl:111: usbcdc.o] Error 1
make[2]: Leaving directory '/home/root/STM32/stm32f103c8t6/rtos/libwwg/src'
make[1]: *** [Makefile:8: all] Error 2
make[1]: Leaving directory '/home/root/STM32/stm32f103c8t6/rtos/libwwg'
make: *** [Makefile:41: libwwg] Error 2
解决方案
所以,我知道问题的根源是什么。Cygwin 中的路径格式存在问题,或者更确切地说,Windows 和 Linux 路径格式之间的交互存在问题。我可以通过将 Makefile 中的路径从 Linux /home/folder 更改为 Windows D:\home\folder\ 格式来解决这个问题。
推荐阅读
- laravel - Vue2 通过 vuex 在独立组件上触发渲染
- go - 字符过多的 Prometheus 时间戳
- c++ - 如何在控制台的c ++中绘制具有对角线和对称轴的矩形?
- javascript - 在同一台服务器(本地服务器)上运行两个 Angular 2+ 项目
- c - 将部分分配到内存中的固定地址(闪存)
- android - 超过 32767 个字符的 textview 会导致应用程序崩溃
- node.js - 将 Heroku Webhook 与 Discord 连接起来
- python - ModuleNotFoundError:从子包间接导入时没有名为“utils”的模块
- c++ - 多重映射中的 std::find_if 使用函子返回错误
- sql - 从一列中选择一个不同的变量