Eclipse/Neon.2 忽略源文件

Eclipse/Neon.2 ignoring a source file

我正在 Eclipse/Neon.2 中处理一个 CDT 项目,该项目针对嵌入式目标进行交叉编译。我已经在项目中添加了一堆 .c 文件,它们会自动包含在构建中,除了(看似)一个。在项目目录中是 STM32F7explore/Utilities/Log/lcd_log.c 其中 STM32F7explore 是 Eclipse 项目目录。如果我尝试手动构建它,控制台 window 会显示:

09:45:52 **** Building Selected Files of configuration Debug for project STM32F7explore ****
Info: Internal Builder is used for build

09:45:52 Build Finished (took 1ms)

对于包含的文件,控制台显示例如

09:54:50 **** Building Selected Files of configuration Debug for project STM32F7explore ****
Info: Internal Builder is used for build
arm-none-eabi-gcc -mcpu=cortex-m7 -mthumb -mfloat-abi=hard -mfpu=fpv5-sp-d16 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F746xx -DLWIP_TIMEVAL_PRIVATE=0 -I../Inc -I../Drivers/STM32F7xx_HAL_Driver/Inc -I../Drivers/STM32F7xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F7xx/Include -I../Drivers/CMSIS/Include -I../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1 -I../Middlewares/Third_Party/FreeRTOS/Source/include -I../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS -I../Middlewares/Third_Party/LwIP/src/include -I../Middlewares/Third_Party/LwIP/system -I../Middlewares/Third_Party/LwIP/src/include/lwip -I../Middlewares/Third_Party/LwIP/src/include/lwip/apps -I../Middlewares/Third_Party/LwIP/src/include/lwip/priv -I../Middlewares/Third_Party/LwIP/src/include/lwip/prot -I../Middlewares/Third_Party/LwIP/src/include/netif -I../Middlewares/Third_Party/LwIP/src/include/netif/ppp -I../Middlewares/Third_Party/LwIP/src/include/netif/ppp/polarssl -I../Middlewares/Third_Party/LwIP/src/include/posix -I../Middlewares/Third_Party/LwIP/src/include/posix/sys -I../Middlewares/Third_Party/LwIP/system/arch -I../Drivers/BSP/STM32746G_Discovery -I../Utilities/Log -O0 -g3 -Wall -fmessage-length=0 -ffunction-sections -c -fmessage-length=0 -o Src/main.o ../Src/main.c 

09:54:51 Build Finished (took 224ms)

我对为什么 Eclipse 不将 lcd_log.c 文件添加到构建中感到困惑。我查看了文件属性弹出窗口,两者看起来相同(特别是,Eclipse 确实将 lcd_log.c 识别为 File (C Source File)

我已从工作区中删除 .metadata/.plugins/org.eclipse.core.runtime/.settings 并从项目中删除 .settings 以强制 Eclipse 重新生成这些内容,但并没有解决问题。

该项目在 Github (https://github.com/HankB/STM32F7explore) 上,但构建的要求有点高,除非您碰巧正在为 ST 嵌入式处理器开发。

谢谢!

这里发生的事情是 Log(或其父目录 Utilities)目录不是项目源的一部分,而是项目中被排除的额外文件。

项目浏览器中有一些视觉线索。比较下图中红色的两个方框:

如您所见,Srcdma2d.c 文件使用的图标不同于 Loglcd_log.c

您可以通过右键单击 -> 资源配置 -> 从构建中排除...[= 重新启用文件夹或单个文件59=] 并在如下所示的弹出窗口中取消选中 DebugRelease

您还可以通过 selecting 项目属性 -> C/C++ General -> Paths 和符号 -> 源位置 选项卡。

我建议的是,不要明确包含 Drivers、Inc 等,而是从根目录开始包含项目中的所有文件。为此,select Source Locations 中的所有现有条目,然后按 Delete。然后,您应该只有一个自动重新创建的条目 /STM32F7Explore,如下所示:(请记住对 Debug 和 Release 进行相同的更改)

然后,如果您确实想要排除 files/folders,请对资源配置重复上述步骤。 CDT 在这里会非常有用,如果您在从构建中排除的源目录下有个人 files/folders,您将获得另一个图标。在这里,我排除了一个 C 文件 (log_lcd.c) 和字体目录:

与上述内容相关的 Eclipse CDT 的一些特定帮助: