cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE "undefined reference to" Error

SLavi
Associate II

Hi all,

I have this Eclipse related error on CubeIDE that is very bizarre and any help for it would really be appreciated.

I have my project running with TouchGFX and everything was smooth to the point that I tried to Discovery Camera BSP file to main.cpp. I have other BSP files that work just fine in main.cpp. All files are defined with headers, their libraries and paths defined but I get an error of undefined reference to `HAL_DCMI_Stop' . This is just an example of one function called from #include "stm32746g_discovery_camera.c" All functions from this file that use HAL library produce this error. Bizarelly I tried calling the same function from one of my screenview.cpp file and it compiled fine without errors; Same header files included in both cases.

Researching the error on eclipse forums, it is defined as a linker error and that the library is to be defined in linker settings, but if it works fine in other cpp files then what may be the problem? I even tried adding the library to the linker but I feel I did it wrong as I got some other very weird errors.

Any help on solving this problem will truly be appreciated.

Many Thanks

Salman

The Console:

11:52:31 **** Incremental Build of configuration Debug for project TouchSSV1.0 ****

make -j4 all 

arm-none-eabi-g++ "../Core/Src/main.cpp" -mcpu=cortex-m7 -std=gnu++14 -g3 -DUSE_HAL_DRIVER -DSTM32F746xx -DDEBUG -c -I../TouchGFX/gui/include -I../Middlewares/Third_Party/FreeRTOS/Source/include -I../TouchGFX/generated/fonts/include -I../Drivers/CMSIS/Device/ST/STM32F7xx/Include -I../TouchGFX/generated/texts/include -I../Drivers/STM32F7xx_HAL_Driver/Inc -I../TouchGFX/generated/images/include -I../Drivers/CMSIS/Include -I../Core/Inc -I../Middlewares/ST/TouchGFX/touchgfx/framework/include -I../TouchGFX/generated/gui_generated/include -I../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1 -I../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS -I../Drivers/STM32F7xx_HAL_Driver/Inc/Legacy -I../TouchGFX/target -I"C:/Users/NTS/STM32CubeIDE/workspace_9.12.19/TouchSSV1.0/STM32746G-Discovery" -I"C:/Users/NTS/STM32CubeIDE/workspace_9.12.19/TouchSSV1.0/Components/ft5336" -I"C:/Users/NTS/STM32CubeIDE/workspace_9.12.19/TouchSSV1.0/Components/ov9655" -O0 -ffunction-sections -fdata-sections -fno-exceptions -fno-rtti -fno-threadsafe-statics -fno-use-cxa-atexit -Wall -fstack-usage -MMD -MP -MF"Core/Src/main.d" -MT"Core/Src/main.o" --specs=nano.specs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Src/main.o"

In file included from ../Core/Src/main.cpp:23:0:

../Core/Src/main.cpp: In function 'int main()':

../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h:461:67: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

 { #name, (thread), (priority), (instances), (stacksz), NULL, NULL }

                                  ^

../Core/Src/main.cpp:194:3: note: in expansion of macro 'osThreadDef'

  osThreadDef(defaultTask, StartDefaultTask, osPriorityNormal, 0, 4096);

  ^~~~~~~~~~~

../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h:461:67: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

 { #name, (thread), (priority), (instances), (stacksz), NULL, NULL }

                                  ^

../Core/Src/main.cpp:199:3: note: in expansion of macro 'osThreadDef'

  osThreadDef(touch, StartTouchTask, osPriorityIdle, 0, 128);

  ^~~~~~~~~~~

../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h:461:67: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

 { #name, (thread), (priority), (instances), (stacksz), NULL, NULL }

                                  ^

../Core/Src/main.cpp:202:3: note: in expansion of macro 'osThreadDef'

  osThreadDef(bulb, StartBulbTask, osPriorityNormal, 0, 128);

  ^~~~~~~~~~~

../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h:461:67: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

 { #name, (thread), (priority), (instances), (stacksz), NULL, NULL }

                                  ^

../Core/Src/main.cpp:205:3: note: in expansion of macro 'osThreadDef'

  osThreadDef(camera, StartCameraTask, osPriorityLow, 0, 1280);

  ^~~~~~~~~~~

arm-none-eabi-g++ -o "TouchSSV1.0.elf" @"objects.list" -l:libtouchgfx-float-abi-hard.a -mcpu=cortex-m7 -T"C:\Users\NTS\STM32CubeIDE\workspace_9.12.19\TouchSSV1.0\STM32F746NGHX_FLASH.ld" --specs=nosys.specs -Wl,-Map="TouchSSV1.0.map" -Wl,--gc-sections -static -L../Middlewares/ST/TouchGFX/touchgfx/lib/core/cortex_m7/gcc --specs=nano.specs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb -Wl,--start-group -lc -lm -lstdc++ -lsupc++ -Wl,--end-group

STM32746G-Discovery/stm32746g_discovery_camera.o: In function `BSP_CAMERA_Stop':

C:/Users/NTS/STM32CubeIDE/workspace_9.12.19/TouchSSV1.0/Debug/../STM32746G-Discovery/stm32746g_discovery_camera.c:276: undefined reference to `HAL_DCMI_Stop'

collect2.exe: error: ld returned 1 exit status

make: *** [makefile:104: TouchSSV1.0.elf] Error 1

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

11:52:44 Build Failed. 2 errors, 4 warnings. (took 12s.680ms)

0 REPLIES 0