Eclipse / Neon.2忽略源文件

时间:2017-02-22 16:03:46

标签: c eclipse eclipse-cdt

我正在使用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嵌入式处理器开发,否则构建的要求有点陡峭。

谢谢!

1 个答案:

答案 0 :(得分:1)

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

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

Src vs Log

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

您可以通过右键单击 - >重新启用该文件夹或单个文件。 资源配置 - > 从Build中排除... 并在弹出窗口中取消选中 Debug Release ,如下所示:

exclude from build pop-up

您还可以通过选择项目属性来控制所包含的内容 - > C / C ++一般 - > 路径和符号 - > 来源地点标签。

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

cleaned-up source configuration

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

exclude the other way

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