Eclipse / Neon.2忽略源文件 [英] Eclipse/Neon.2 ignoring a source file

查看:111
本文介绍了Eclipse / Neon.2忽略源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

  09:45:52 ****项目STM32F7explore的配置调试**** 
信息:内部生成器用于构建

09:45:52构建完成(花费1ms)

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

  09:54:50 ****为项目STM32F7explore构建配置调试的选定文件**** 
信息:Internal Builder用于构建
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 / FreeR TOS /源/包含-I ../中间件/第三方-Free./RTS/源/ CMSIS_RTOS -I ../中间件/第三方_LyIP / src /包括-I ../中间件/第三方-LyIP /系统-I ../中间件/第三方_LwIP / src / include / lwip -I ../中间件/第三方/ LwIP / src / include / lwip / apps -I ../中间件/第三方_LyIP / swp / 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-部分-c -fmessage-length = 0 -o Src / main.o ../Src/main.c

09:54:51构建完成(耗时224ms)

我对为什么不添加lcd_log感到困惑.c文件生成。我查看了文件属性弹出窗口,它们的外观相同(特别是,Eclipse确实将lcd_log.c识别为 File(C源文件)



我已从工作区中删除 .metadata / .plugins / org.eclipse.core.runtime / .settings ,并且<项目中的code> .settings 强制Eclipse重新生成它们,但这并不能解决问题。



该项目正在进行Github(



您可以看到 Src dma2d.c 文件使用的图标与 Log lcd_log.c



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





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



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





然后,如果您确实要排除文件/文件夹,请重复上述步骤与资源配置。 CDT在这里将非常有帮助,如果您在源目录中有单独的文件/文件夹,而该目录不包含在构建中,则您将获得另一个图标。在这里,我排除了单个C文件(log_lcd.c)和字体目录:





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




I'm working with a CDT project in Eclipse/Neon.2 which cross compiles for an embedded target. I've added a bunch of .c files to the project and they are automatically included in the build except for (seemingly) one. In the project directory it is STM32F7explore/Utilities/Log/lcd_log.c where STM32F7explore is the Eclipse project directory. If I try to build it manually, the Console window shows:

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)

For files that are included, the Console shows e.g.

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)

I'm baffled by why Eclipse doesn't add the lcd_log.c file to the build. I've looked at the file properties popup and they look the same for both (and in particular, Eclipse does recognize lcd_log.c as File (C Source File)

I've deleted .metadata/.plugins/org.eclipse.core.runtime/.settings from the workspace and .settings from the project to force Eclipse to regenerate these and that did not fix the problem.

The project is on Github (https://github.com/HankB/STM32F7explore) but the requirements to build are a bit steep unless you happen to be developing for ST embedded processors.

Thanks!

解决方案

What is going on here is the Log (or its parent Utilities) directory is not part of the source of your project, but rather extra files in the project that are excluded.

There are some visual clues in the project explorer. Compare the two boxes in red below:

As you can see the Src and dma2d.c files use different icons than Log and lcd_log.c.

You can re-enable the folder, or individual files, by right-clicking -> Resource Configurations -> Exclude From Build... and unchecking Debug and Release in the pop-up that looks like this:

You can also control what is included by selecting project properties -> C/C++ General -> Paths and Symbols -> Source Locations tab.

What I would recommend is that rather than having Drivers, Inc, etc be explicitly included, that you include all files in your project starting at the root. To do that, select all the existing entries in Source Locations and press Delete. You should then have just one automatically re-created entry /STM32F7Explore, like this: (Remember to do the same change to both Debug and Release)

Then, if you actually do want to exclude files/folders, repeat the above steps with Resource Configurations. CDT will be be quite helpful here, if you have individual files/folders under a source directory excluded from the build you will get yet another icon. Here I have excluded a single C file (log_lcd.c) and the Fonts directory:

Some of the specific help for Eclipse CDT that relates to the above:

这篇关于Eclipse / Neon.2忽略源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆