cancel
Showing results for 
Search instead for 
Did you mean: 

MX_RTC_Init undefined

iDeew
Associate II

Hi,

I'm getting this below compile time errors...

 

 

undefined reference to `MX_RTC_Init'

 

 

However, I have included the rtc.h header file, which contains the declaration of the MX_RTC_Init(void) function.

 

 

#include "main.h"
#include "cmsis_os.h"
#include "fdcan.h"
#include "i2c.h"
#include "lwip.h"
#include "rtc.h"
#include "spi.h"
#include "usart.h"
#include "usb_device.h"
#include "app_touchgfx.h"

 

 

Why does CubeIDE still giving me this error?

Thanks

 

11 REPLIES 11
STTwo-32
ST Employee

Hello @iDeew and welcome to the ST Community :smiling_face_with_smiling_eyes:.

Could you please share your .ioc file. Also, tell me the versions of CubeMX and CubeIDE that you are using.

Best Regards.

STTwo-32 

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.

You meant .ioc file?
Pleas see attached.

CubeMX 6.11.1
CubeIDE v1.16.0

Could you please try using the last version of CubeMX (V6.12.0).

Best Regards.

STTwo-32

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.

That's a linker error - not a compiler error.

 


@iDeew wrote:

I have included the rtc.h header file, which contains the declaration of the MX_RTC_Init(void) function.


That's right: it contains only a declaration - not the definition.

The error message said that it's the definition that's missing.

The definition would be in the rtc.c source file - so check that's correctly included in the project ...

I upgraded to v6.12.0.
But CubeIDE is giving me the exact same error. Below is the what I see in console.

make -j8 all 
arm-none-eabi-g++ "C:/mv2t/TouchGFX/gui/src/containers/RTC_Container.cpp" -mcpu=cortex-m7 -std=gnu++14 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32H750xx -DUSE_USB_FS -DUSE_BPP=16 -c -I../../LWIP/App -I../../TouchGFX/target -I../../USB_DEVICE/Target -I../../Middlewares/Third_Party/LwIP/src/include/compat/posix/net -I../Middlewares/Third_Party/LwIP/src/include/compat/stdc -I../../Middlewares/Third_Party/LwIP/src/include/compat/stdc -I../Middlewares/Third_Party/LwIP/system/arch -I../Middlewares/Third_Party/LwIP/src/include -I../../Middlewares/Third_Party/LwIP/system/arch -I../Middlewares/Third_Party/LwIP/src/include/lwip -I../../Middlewares/Third_Party/LwIP/system -I../../Middlewares/Third_Party/LwIP/src/include -I../Middlewares/Third_Party/FreeRTOS/Source/include -I../../Drivers/CMSIS/Include -I../USB_DEVICE/Target -I../Middlewares/Third_Party/LwIP/src/include/lwip/priv -I../../Middlewares/Third_Party/LwIP/src/include/lwip/priv -I../../LWIP/Target -I../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I../../Middlewares/Third_Party/LwIP/src/include/lwip -I../Middlewares/Third_Party/LwIP/src/include/compat/posix/sys -I../../Middlewares/Third_Party/LwIP/src/include/compat/posix -I../../Drivers/BSP/Components/lan8742 -I../Utilities/JPEG -I../Drivers/CMSIS/Include -I../../Middlewares/Third_Party/LwIP/src/include/compat/posix/sys -I../../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F -I../TouchGFX/App -I../../Middlewares/Third_Party/LwIP/src/include/netif -I../../Middlewares/Third_Party/LwIP/src/include/compat/posix/arpa -I../Middlewares/Third_Party/LwIP/src/include/netif -I../../Core/Inc -I../Middlewares/Third_Party/LwIP/src/include/netif/ppp -I../../Middlewares/Third_Party/LwIP/src/include/netif/ppp -I../../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I../Middlewares/ST/STM32_USB_Device_Library/Core/Inc -I../../Drivers/STM32H7xx_HAL_Driver/Inc -I../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F -I../LWIP/App -I../Middlewares/Third_Party/LwIP/src/include/compat/posix -I../../Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc -I../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I../../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I../Middlewares/Third_Party/LwIP/src/include/compat/posix/arpa -I../Middlewares/Third_Party/LwIP/system -I../../USB_DEVICE/App -I../../TouchGFX/App -I../../Middlewares/Third_Party/LwIP/src/include/lwip/apps -I../../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS -I../Middlewares/Third_Party/LwIP/src/include/lwip/prot -I../../TouchGFX/target/generated -I../../Middlewares/Third_Party/LwIP/src/include/lwip/prot -I../Middlewares/Third_Party/LwIP/src/include/lwip/apps -I../TouchGFX/target/generated -I../../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I../../Middlewares/ST/STM32_USB_Device_Library/Core/Inc -I../Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc -I../USB_DEVICE/App -I../../Middlewares/Third_Party/FreeRTOS/Source/include -I../LWIP/Target -I../Middlewares/Third_Party/LwIP/src/include/compat/posix/net -I../TouchGFX/target -I../Drivers/STM32H7xx_HAL_Driver/Inc -I../../Drivers/Vendor/Board/SE21159/Config -I../../Drivers/Vendor/Device -I../../Drivers/Vendor/Driver -I../../ETHERNET_IF/App/tcpecho -I../../ETHERNET_IF/Target -I../../Middlewares/ST/touchgfx/framework/include -I../../TouchGFX/generated/fonts/include -I../../TouchGFX/generated/gui_generated/include -I../../TouchGFX/generated/images/include -I../../TouchGFX/generated/texts/include -I../../TouchGFX/generated/videos/include -I../../TouchGFX/gui/include -O0 -ffunction-sections -fdata-sections -fno-exceptions -fno-rtti -fno-use-cxa-atexit -Wall -femit-class-debug-always -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Application/User/gui/RTC_Container.d" -MT"Application/User/gui/RTC_Container.o" --specs=standard_c_nano_cpp.specs -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -o "Application/User/gui/RTC_Container.o"
arm-none-eabi-g++ -o "EVK101009A.elf" @"objects.list"  -l:libtouchgfx-float-abi-hard.a -mcpu=cortex-m7 -T"C:\mv2t\STM32CubeIDE\STM32H750_FLASH.ld" --specs=nosys.specs -Wl,-Map="EVK101009A.map" -Wl,--gc-sections -static -L../../Middlewares/ST/touchgfx/lib/core/cortex_m7/gcc --specs=standard_c_nano_cpp.specs -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -Wl,--start-group -lc -lm -lstdc++ -lsupc++ -Wl,--end-group
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/Core/main.o: in function `main':
C:/mv2t/Core/Src/main.c:119: undefined reference to `MX_RTC_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/gui/RTC_Container.o: in function `RTC_Container::RTC_TimeShow()':
C:/mv2t/TouchGFX/gui/src/containers/RTC_Container.cpp:31: undefined reference to `HAL_RTC_GetTime'
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:/mv2t/TouchGFX/gui/src/containers/RTC_Container.cpp:35: undefined reference to `hrtc'
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/gui/RTC_Date.o: in function `RTC_Date::RTC_TimeShow()':
C:/mv2t/TouchGFX/gui/src/containers/RTC_Date.cpp:23: undefined reference to `HAL_RTC_GetDate'
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:/mv2t/TouchGFX/gui/src/containers/RTC_Date.cpp:26: undefined reference to `hrtc'
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:108: EVK101009A.elf] Error 1
"make -j8 all" terminated with exit code 2. Build might be incomplete.

01:11:55 Build Failed. 6 errors, 0 warnings. (took 7s.582ms)

Thanks

 

Yes, you are correct. It is a Linker error.
Any idea why I'm getting it?

Thanks

STTwo-32
ST Employee

If you still have the same error. Can you send you project here. 

Best Regards.

STTwo-32

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.


@iDeew wrote:

Any idea why I'm getting it?


Because the rtc.c source file - which contains the definition - isn't being built and/or isn't being linked.

Is it present in your Project?

As @STTwo-32 said, you could attach the Project...

Christian N
ST Employee

This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.