TouchGFX_STM32H7B3I-DK_Build Errors
- January 29, 2025
- 3 replies
- 2254 views
Dear Sir,
Hardware: STM32H7B3I-DK
Software: STM32MX 6.13.0 / STM32CubeIDE 1.17.0 / TouchGFX 4.24.1/ STM32Cube_FW_H7_V1.12.0
Start the project from TouchGFX, and then refer to STM32 Graphics Workshop (STM32H7BWorkshop2020_labs12345), to develop the details in Model.hpp, ModelListener.hpp, Model.cpp, and main.c, etc. Aiming to display a data from hardware side on the screen, at this stage it is just a float constant (as can be seen in main.c), later it will be data from an external ADC.
The project can display a float constant (the 1.5555) in the Simulator on TouchGFX (refer to Model.cpp file), but in STM32CubeIDE, there are 2 build errors as show below (As a result, unable to show the float constant from main.c on the screen.):
(Copy from the Console of STM32CubeIDE after build):
C:/TouchGFXProjects/ADC_Output_Display/TouchGFX/gui/src/model/Model.cpp:30: undefined reference to `Adc_Output_GetValue'
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:103: STM32H7B3I-DK.elf] Error 1
"make -j2 all" terminated with exit code 2. Build might be incomplete.
17:19:18 Build Failed. 2 errors, 1 warnings. (took 29s.943ms)
The Adc_Output_GetValue() has already been defined both in Model.cpp and main.c; so not sure what means the: undefined reference to ‘Adc_Output_GetValue’; and do not know what to do next.
Also do not understand the meaning of:
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:103: STM32H7B3I-DK.elf] Error 1
Could you please provide your advice, and suggestion about what to do?
Thank you very much for your attention and support.
With best regards
EY1
P.S.
The print screen for above project:
Simulator result:

STM32CubeIDE Build Results (below 2):


Also enclosed in the attachment is main.c
Model.cpp and Model.hpp are not allow to attach, due to the cpp and hpp extension.
So, enclose the Model.cpp content below:
Model.cpp
#include <gui/model/Model.hpp>
#include <gui/model/ModelListener.hpp>
extern "C" {
extern float Adc_Output_GetValue(void);
}
Model::Model() : modelListener(0)
, tickCounter(0)
{
}
void Model::tick()
{
tickCounter++;
if ((tickCounter % 20) == 0)
{
if (modelListener != 0)
{
modelListener->notifyAdc_VoltChanged(getNewAdc_Volt());
}
}
}
float Model::getNewAdc_Volt()
{
#ifndef SIMULATOR
return Adc_Output_GetValue();
#else
// Implementation for simulator
return 1.5555;
#endif /*SIMULATOR*/
}
Thank you very much for your time and help.
