Eclipse / Neon.2忽略源文件

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

 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 )目录不是项目源的一部分,而是项目中被排除的额外文件。

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

Src vs Log

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

您可以通过右键单击 – > 资源配置 – > 从生成中排除…重新启用文件夹或单个文件,并在弹出窗口中取消选中“ 调试发布” ,如下所示:

从构建弹出窗口中排除

您还可以通过选择项目属性 – > C / C ++常规 – > 路径和符号 – > 源位置选项卡来控制包含的内容。

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

清理源配置

然后,如果您确实要排除文件/文件夹,请使用“资源配置”重复上述步骤。 CDT在这里会非常有用,如果您在源目录下排除了单独的文件/文件夹,那么您将获得另一个图标。 这里我排除了一个C文件(log_lcd.c)和Fonts目录:

排除其他方式

Eclipse CDT的一些特定帮助与上述有关:

  • 图标叠加层显示在C / C ++ Projects View帮助的底部
  • 源位置选项卡帮助