cancel
Showing results for 
Search instead for 
Did you mean: 

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

MCA_Dev
Associate II

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!

14 REPLIES 14

Hello,

the first one (Libraries tab) should be the same as the picture (:libtouchgfx-float-abi-hard.a) while the second one (Library path) should be related to the microcontroller you are using (in your case an M4 based microcontroller so the path will be ../Middlewares/ST/touchgfx/lib/core/cortex_m4/gcc).

 

You can also generate as a reference one of the TouchGFX examples/demonstration of the same microcontroller family you are using and check what it is automatically set on those tabs.

Best regards 

Thank you so much for your giving me the response.

I tried this but now I'm getting another error which is related to path of Libararies tab.

Screenshot 2024-09-19 160809.png

I've tried generating an example project and the correct library path is:

../Middlewares/ST/touchgfx/lib/core/cortex_m4f/gcc

As you can see in the folders that TouchGFX designer has generated after the "Code generation" process.

Best regards

 

It worked after I added the path and library name in Properties->C/C++ Build->Settings->MCU/MPU G++ Linker->Libraries.

Screenshot 2024-09-19 222419.png

Thank you so much for the help Man!!!

LouisB
ST Employee

Hello @MCA_Dev ,

The 4.24.1 is out with a fix for issue.

BR,

Louis BOUDO
ST Software Developer | TouchGFX