cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot build project with CubeIDE (undefined reference to ...)

MCA_Dev
Associate

Hello, I'm trying to setup a simple "Hello world" project for a custom board with an STM32H7A3IIT6.

I've successfully created the project from CubeMX (6.12) generated the code for Keil MDK and, starting from the application template of the TGFX designer (4.24), I managed to add the GUI to the project, compile and flash the board successfully.

As I wanted to start using CubeIDE (currently version 1.16) I tried the same approach, so:

- CubeMX ioc project (copy of the same file used before for the Keil code generation)

- Generate code for CubeIDE ("Generate under root" checked as with unchecked it gave me the following error (https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/touchgfx-designer-error-quot-unable-to-locate-c-lt-path-to/td-p/100242)

- Open the generated "ApplicationTemplate.touchgfx.part" file with TouchGFX Designer

- Import the Blank UI and put a coloured box on the main screen

- Generate code

- Open the project with CubeIDE and build the project

-> This leads to 174 errors, all of them referred to undefined reference to touchgfx::xyz (with xyz = AbstractPartition, Application, Container, etc)

So I tried on CubeIDE to select Project->Convert to C and tried to build again.

-> This leads to a couple of errors, the same case of:

https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/undefined-reference-to-touchgfx-init/td-p/175810

https://community.st.com/t5/stm32cubemx-mcus/stm32h747iitx-undefined-reference-to-touchgfx-init-its-stm32/td-p/154926/page/2

with:

C:/TouchGFXProjects/STM32H7_DTouch1_TGFX/TouchGFX/App/app_touchgfx.c:68: undefined reference to `touchgfx_components_init'

C:/ST/STM32CubeIDE_1.16.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.0.200.202406191623/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: C:/TouchGFXProjects/STM32H7_DTouch1_TGFX/TouchGFX/App/app_touchgfx.c:69: undefined reference to `touchgfx_init'

C:/ST/STM32CubeIDE_1.16.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.0.200.202406191623/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: ./Application/User/TouchGFX/App/app_touchgfx.o: in function `TouchGFX_Task':

C:/TouchGFXProjects/STM32H7_DTouch1_TGFX/TouchGFX/App/app_touchgfx.c:87: undefined reference to `touchgfx_taskEntry'

collect2.exe: error: ld returned 1 exit status

make: *** [makefile:67: STM32H7_DTouch1_TGFX.elf] Error 1

"make -j4 all" terminated with exit code 2. Build might be incomplete.

Build Failed. 4 errors, 0 warnings.

The solutions proposed in the other forum discussions didn't solve my case.

I hope I've been clear enough to explain my case and you can help me with this topic.

Thank you!

1 REPLY 1
GaetanGodart
ST Employee

Hello @MCA_Dev ,

 

Martin's answer wasn't helpful to solve the "generate under root" issue?
It is usually not recommended to generate under root.

To compile TouchGFX project, you shouldn't convert to C as TouchGFX is C++.

Maybe the 174 errors could be solves by including the different folder of your project, I expect the folders generated by TouchGFX Designer to maybe not be included in the STM32CubeIDE project.

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)