关于TouchGFX生成MDK5工程编译报错:xxx: error: #5: cannot open source input file “xxx”: No such file or directory的解决方法

TouchGFX软件版本:4.14.0

MDK5软件版本:V5.29.0.0

STM32CubeMX软件版本:6.0.1

开发板:STM32F769I_DISCO

桌面系统:Window10

TouchGFX选择开发板STM32F769I_DISCO,应用模板为空白模板,点击生成代码,完成后,用MDK5打开编译后报错,提示找不到C++的头文件hpp文件,这个报错一度困扰我很久,最后偶然找到解决方法。

Build started: Project: STM32F769I_DISCO
*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'C:Keil_v5ARMARMCCBin'
*** Warning: You are compiling one or more files of source type C++ and have selected 'use MicroLIB'. MicroLIB does not support C++!
  
Build target 'STM32F769I_DISCO'
assembling startup_stm32f769xx.s...
compiling Buttons.cpp...
../TouchGFX/target/Buttons.cpp(39): error:  #5: cannot open source input file "touchgfx/hal/Buttons.hpp": No such file or directory
  #include <touchgfx/hal/Buttons.hpp>
../TouchGFX/target/Buttons.cpp: 0 warnings, 1 error
compiling CortexMMCUInstrumentation.cpp...
../TouchGFX/target/CortexMMCUInstrumentation.hpp(4): error:  #5: cannot open source input file "platform/core/MCUInstrumentation.hpp": No such file or directory
  #include <platform/core/MCUInstrumentation.hpp>
../TouchGFX/target/CortexMMCUInstrumentation.cpp: 0 warnings, 1 error
compiling KeySampler.cpp...
../TouchGFX/target/KeySampler.hpp(42): error:  #5: cannot open source input file "platform/driver/button/ButtonController.hpp": No such file or directory
  #include <platform/driver/button/ButtonController.hpp>
../TouchGFX/target/KeySampler.cpp: 0 warnings, 1 error
compiling STM32TouchController.cpp...
../TouchGFX/target/STM32TouchController.hpp(23): error:  #5: cannot open source input file "platform/driver/touch/TouchController.hpp": No such file or directory
  #include <platform/driver/touch/TouchController.hpp>
../TouchGFX/target/STM32TouchController.cpp: 0 warnings, 1 error
compiling TouchGFXHAL.cpp...
../TouchGFX/target/generated/TouchGFXGeneratedHAL.hpp(20): error:  #5: cannot open source input file "touchgfx/hal/HAL.hpp": No such file or directory
  #include <touchgfx/hal/HAL.hpp>
../TouchGFX/target/TouchGFXHAL.cpp: 0 warnings, 1 error
compiling TouchGFXGPIO.cpp...
../TouchGFX/target/TouchGFXGPIO.cpp(18): error:  #5: cannot open source input file "touchgfx/hal/GPIO.hpp": No such file or directory
  #include <touchgfx/hal/GPIO.hpp>
../TouchGFX/target/TouchGFXGPIO.cpp: 0 warnings, 1 error
compiling TouchGFXConfiguration.cpp...
../TouchGFX/target/generated/TouchGFXConfiguration.cpp(17): error:  #5: cannot open source input file "texts/TypedTextDatabase.hpp": No such file or directory
  #include <texts/TypedTextDatabase.hpp>
../TouchGFX/target/generated/TouchGFXConfiguration.cpp: 0 warnings, 1 error
compiling TouchGFXGeneratedHAL.cpp...
../TouchGFX/target/generated/TouchGFXGeneratedHAL.hpp(20): error:  #5: cannot open source input file "touchgfx/hal/HAL.hpp": No such file or directory
  #include <touchgfx/hal/HAL.hpp>
../TouchGFX/target/generated/TouchGFXGeneratedHAL.cpp: 0 warnings, 1 error
compiling app_touchgfx.c...
compiling STM32DMA.cpp...
../TouchGFX/target/generated/STM32DMA.cpp(20): error:  #5: cannot open source input file "touchgfx/hal/OSWrappers.hpp": No such file or directory
  #include <touchgfx/hal/OSWrappers.hpp>
../TouchGFX/target/generated/STM32DMA.cpp: 0 warnings, 1 error
compiling OSWrappers.cpp...
../TouchGFX/target/generated/OSWrappers.cpp(17): error:  #5: cannot open source input file "touchgfx/hal/OSWrappers.hpp": No such file or directory
  #include <touchgfx/hal/OSWrappers.hpp>
../TouchGFX/target/generated/OSWrappers.cpp: 0 warnings, 1 error
compiling stm32f7xx_it.c...
compiling freertos.c...
compiling main.c...
compiling otm8009a.c...
compiling stm32f7xx_hal_timebase_tim.c...
compiling stm32f7xx_hal_msp.c...
compiling ft6x06.c...
compiling stm32f7xx_hal_cortex.c...
compiling stm32f7xx_hal_crc.c...
compiling stm32f7xx_hal_crc_ex.c...
compiling stm32f7xx_hal_rcc.c...
compiling stm32f7xx_hal_rcc_ex.c...
compiling stm32f7xx_hal_flash.c...
compiling stm32f7xx_hal_flash_ex.c...
compiling stm32f7xx_hal_gpio.c...
compiling stm32f7xx_hal_dma.c...
compiling stm32f7xx_hal_pwr.c...
compiling stm32f7xx_hal_pwr_ex.c...
compiling stm32f7xx_hal_dma_ex.c...
compiling stm32f7xx_hal.c...
compiling stm32f7xx_hal_i2c_ex.c...
compiling stm32f7xx_hal_exti.c...
compiling stm32f7xx_hal_dma2d.c...
compiling stm32f7xx_hal_i2c.c...
compiling stm32f7xx_hal_sdram.c...
compiling stm32f7xx_ll_fmc.c...
compiling stm32f7xx_hal_dsi.c...
compiling stm32f7xx_hal_ltdc_ex.c...
compiling stm32f7xx_hal_ltdc.c...
compiling stm32f7xx_hal_qspi.c...
compiling system_stm32f7xx.c...
compiling stm32f7xx_hal_tim_ex.c...
compiling croutine.c...
compiling stm32f7xx_hal_tim.c...
compiling event_groups.c...
compiling list.c...
compiling stream_buffer.c...
compiling queue.c...
compiling timers.c...
compiling tasks.c...
compiling heap_4.c...
compiling port.c...
compiling cmsis_os2.c...
"STM32F769I_DISCOSTM32F769I_DISCO.axf" - 10 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed:  00:00:12

  

关于TouchGFX生成MDK5工程编译报错:xxx: error: #5: cannot open source input file "xxx": No such file or directory的解决方法

话不多说,直接介绍我的解决方法:

其实很简单,就一句话:先用TouchGFX建造工程,并生成代码工程,生成的工程文件夹里面有一个STM32CubeMX的工程文件,打开,再用STM32CubeMX生成代码工程(不要改变任何配置,包括工程路径和名字,除了一点,下面会提到)。然后,再一次用TouchGFX生成代码工程,之后用MDK5打开工程就可以正常编译通过了!

注意:

  =》工程目录下会有两个STM32CubeMX工程文件,例如我的两个文件是:STM32F769I_DISCO.ioc和backup_STM32F769I_DISCO.ioc,打开前者,后者是备份文件,无需理会。

  =》如果用STM32CubeMX打开文件出现如图所示提示,点击中间的“Migrate”按钮

关于TouchGFX生成MDK5工程编译报错:xxx: error: #5: cannot open source input file "xxx": No such file or directory的解决方法

  =》在Project Manage选项卡里面,Toolchain/IDE选项默认是STM32CubeIDE,将其改为MDK-ARM,版本号的话,笔者选的是V5.27,其他版本号没有测试过。注意,在用STM32CubeMX的过程中,只有这一点需要修改,其他不要改动!

关于TouchGFX生成MDK5工程编译报错:xxx: error: #5: cannot open source input file "xxx": No such file or directory的解决方法

 

  =》再次打开TouchGFX的这个工程(笔者用STM32CubeMX时是关闭TouchGFX的,打开没试过),点击右上角Generate Code再一次生成代码工程,完毕后,打开MDK编译即可通过。

  =》编译通过后会有一个警告:STM32F769I_DISCO.sct(18): warning: L6314W: No section matches pattern *.o(ExtFlashSection).,这是因为这个应用模板是空白模板,没有任何数据存在外部flash中,什么图片啊,字体啊什么的。所以这个警告无需理会,要想验证的话可以在TouchGFX中随便显示张图片,这个警告就会消失了。亲测有效。

 

原文链接: https://www.cnblogs.com/zhusl/p/13639548.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

    关于TouchGFX生成MDK5工程编译报错:xxx: error: #5: cannot open source input file "xxx": No such file or directory的解决方法

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/202550

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月12日 下午9:12
下一篇 2023年2月12日 下午9:12

相关推荐