cancel
Showing results for 
Search instead for 
Did you mean: 

Hello Everyone, I'm trying to run the sample code given to me by the provider of our board and I'm having a problem when I try to build the project.

NPine.1
Associate

This is the sample error that pops up. How can I fix this? I'm very new to this so I'm not very familiar with this error. Hope that someone could help me with this. Tell me what else I need to provide so you can help me better.

/Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.macos64_1.0.0.202111181127/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: /Users/nyo/STM32CubeIDE/workspace_1.10.1/0_testagain/Debug/../Src/gpio.c:96: undefined reference to `HAL_GPIO_Init'

/Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.macos64_1.0.0.202111181127/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: /Users/nyo/STM32CubeIDE/workspace_1.10.1/0_testagain/Debug/../Src/gpio.c:98: undefined reference to `HAL_GPIO_WritePin'

/Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.macos64_1.0.0.202111181127/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: /Users/nyo/STM32CubeIDE/workspace_1.10.1/0_testagain/Debug/../Src/gpio.c:99: undefined reference to `HAL_Delay'

/Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.macos64_1.0.0.202111181127/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: /Users/nyo/STM32CubeIDE/workspace_1.10.1/0_testagain/Debug/../Src/gpio.c:100: undefined reference to `HAL_GPIO_WritePin'

/Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.macos64_1.0.0.202111181127/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: /Users/nyo/STM32CubeIDE/workspace_1.10.1/0_testagain/Debug/../Src/gpio.c:102: undefined reference to `HAL_GPIO_WritePin'

/Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.macos64_1.0.0.202111181127/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: /Users/nyo/STM32CubeIDE/workspace_1.10.1/0_testagain/Debug/../Src/gpio.c:104: undefined reference to `HAL_GPIO_WritePin'

/Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.macos64_1.0.0.202111181127/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: /Users/nyo/STM32CubeIDE/workspace_1.10.1/0_testagain/Debug/../Src/gpio.c:129: undefined reference to `HAL_GPIO_WritePin'

/Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.macos64_1.0.0.202111181127/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: /Users/nyo/STM32CubeIDE/workspace_1.10.1/0_testagain/Debug/../Src/gpio.c:131: undefined reference to `HAL_GPIO_WritePin'

3 REPLIES 3
Peter BENSCH
ST Employee

Welcome, @Niño Adrian Pineda​, to the community!

obviously there are calls to the HAL in your project, but the HAL is not referenced to the project or not yet accessible. You should consult the board manufacturer's documentation, which probably contains instructions on how to create a project for your board or how to include the HAL.

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
NPine.1
Associate

Hello Peter,

It is already resolved thank you!

But I have another problem encountered. I will attach a picture of the error. I'm using STMcubeIDE on macOS. 0693W00000SwD79QAF.png 

0693W00000SwD7cQAF.png

Presumably this is an already prepared project that has been set up on a Windows computer. The person had inserted a command to create a HEX from the ELF file that uses a Windows executable, which of course does not work on your Mac.

However, it is not necessary to do this there as a post-build command (already because of the platform dependency), so you can simply delete that command:

Project > Properties > C/C++ Build > Settings > Build Steps > Post-build steps > Command

The STM32CubeIDE offers a dedicated option for this:

Project > Properties > C/C++ Build > Settings > Tool Settings > MCU Post build options

and tick Convert to Intel Hex file

Good luck!

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.