2025-04-29 5:36 AM - last edited on 2025-04-29 5:43 AM by GaetanGodart
Hi everyone,
I'm facing a strange issue in my TouchGFX project. I added a new method function1() in my Screen1View class,
and when i create the definition of that function1() in screen1View.cpp it showing the function not declared i followed controllltech youtube tutorial but for me im stuck here.
i will share the .hpp and .cpp and error messages
error im getting
16:39:36 **** Incremental Build of configuration Debug for project STM32H735G-DK ****
make -j8 all
arm-none-eabi-g++ "C:/TouchGFXProjects/MyApplication_14/TouchGFX/gui/src/screen1_screen/Screen1View.cpp" -mcpu=cortex-m7 -std=gnu++14 -g3 -DUSE_HAL_DRIVER -DUSE_BPP=24 -DDEBUG -DSTM32H735xx -DUSE_PWR_DIRECT_SMPS_SUPPLY -c -I../../Core/Inc -I../../TouchGFX/App -I../../TouchGFX/target/generated -I../../TouchGFX/target -I../../Drivers/STM32H7xx_HAL_Driver/Inc -I../../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I../../Middlewares/Third_Party/FreeRTOS/Source/include -I../../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I../../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F -I../../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I../../Drivers/CMSIS/Include -I../../Drivers/BSP/Components/Common -I../../Drivers/BSP/STM32H735G-DK -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/gui/include -I../../TouchGFX/generated/videos/include -I../../LIBJPEG/App -I../../LIBJPEG/Target -I../../Middlewares/Third_Party/LibJPEG/include -Os -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/Screen1View.d" -MT"Application/User/gui/Screen1View.o" --specs=nano.specs -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -o "Application/User/gui/Screen1View.o"
C:/TouchGFXProjects/MyApplication_14/TouchGFX/gui/src/screen1_screen/Screen1View.cpp:19:6: error: no declaration matches 'void Screen1View::function1()'
19 | void Screen1View::function1()
| ^~~~~~~~~~~
C:/TouchGFXProjects/MyApplication_14/TouchGFX/gui/src/screen1_screen/Screen1View.cpp:19:6: note: no functions named 'void Screen1View::function1()'
In file included from C:/TouchGFXProjects/MyApplication_14/TouchGFX/gui/src/screen1_screen/Screen1View.cpp:1:
../../TouchGFX/gui/include/gui/screen1_screen/Screen1View.hpp:7:7: note: 'class Screen1View' defined here
7 | class Screen1View : public Screen1ViewBase
| ^~~~~~~~~~~
make: *** [Application/User/gui/subdir.mk:34: Application/User/gui/Screen1View.o] Error 1
"make -j8 all" terminated with exit code 2. Build might be incomplete.
16:39:37 Build Failed. 2 errors, 0 warnings. (took 860ms)
.hpp file
#ifndef SCREEN1VIEW_HPP
#define SCREEN1VIEW_HPP
#include <gui_generated/screen1_screen/Screen1ViewBase.hpp>
#include <gui/screen1_screen/Screen1Presenter.hpp>
class Screen1View : public Screen1ViewBase
{
public:
Screen1View();
virtual ~Screen1View() {}
virtual void setupScreen();
virtual void tearDownScreen();
virtual void function1();
protected:
};
#endif // SCREEN1VIEW_HPP
.cpp file below
#include <gui/screen1_screen/Screen1View.hpp>
Screen1View::Screen1View()
{
}
void Screen1View::setupScreen()
{
Screen1ViewBase::setupScreen();
}
void Screen1View::tearDownScreen()
{
Screen1ViewBase::tearDownScreen();
}
void Screen1View::function1()
{
}
Solved! Go to Solution.
2025-04-30 6:18 AM
There is a * in front of your hpp file name, this is because the file have has a change and you did not save.
Perhaps you added the line 16 and did not save, so for the compiler, the line 16 doesn't exist and same for the zipping program.
Can you save your file and try again?
removing the function definition in the cpp file
it will compilee the code that i checked
If my guess above is right then yes, removing the definition in the cpp would compile fine (I have also tried that with the zip file you shared and it worked for me too).
but even if i add function definition in cpp file it should compile right ?
If you only add a function definition in a cpp file but no function declaration in a hpp file, I don't thing it would compile.
However, having a function declaration in a hpp file but no function definition in cpp would compile.
Alternatively you could also directly do both the declaration and the definition of the function at once in the hpp.
I think the first step would be to save your project and try again to compile.
You can also unzip the file and sent me and you will see that there is no function declaration in the hpp.
Regards,
2025-04-29 6:10 AM
Hello @Jerrythottathil ,
When adding code, I recommend you to use the "Insert code" button to keep thinks clear :
I have modified your post for this time. :)
I have copy pasted your function 1 declaration and definition in a random project where I have Screen1View as well and it compiled fine.
How did you create your TouchGFX Project?
Did you make it from scratch (including the Makefile)?
Did you create it from TouchGFX Designer by creating either a simulator project or a project linked to a board + display combo?
Can you share your full project?
Regards,
2025-04-29 11:35 PM
Sorry sir, i will use the "Insert code" button for code..
How did you create your TouchGFX Project?
create new-> choosed board stm32h735g-discoverykit -> then just following https://www.youtube.com/watch?v=rGxDZPYcWIs&list=PLfIJKC1ud8giOsk-C4BCOwSHtbXqTNb1W&index=1
when i tried to edit the function and build as in video 6:15
mine was getting error
Did you make it from scratch (including the Makefile)?
i don't know how to do that i was following the video
Did you create it from TouchGFX Designer by creating either a simulator project or a project linked to a board + display combo?
yes using desinger i generated then from generated file i opened the stmcube ide and tried to edit the code as in the video
Can you share your full project?
i have attached zip file of the project sir
Is there any thing please ask sir
and please guide me
2025-04-30 2:03 AM
Hello @Jerrythottathil ,
When I tried to run your application, it also failed for me.
The reason is that the function declaration un your hpp file is missing (your hpp file is not the same as the code you shared in your first post).
After adding the function declaration to the hpp file (or removing the function definition in the cpp file), it compiled fine.
Regards,
2025-04-30 2:33 AM
u can see the function declaration in hpp file right
that line 16 function1()
removing the function definition in the cpp file
it will compilee the code that i checked
but even if i add function definition in cpp file it should compile right ?
if i need to add some led toggling it should be inside that function right and it should be in cpp file also right? (u can check the yt video i shared he's toggling diplay using this function)
this is the thing im not able to do and why im not able to call that function in cpp file?
2025-04-30 6:18 AM
There is a * in front of your hpp file name, this is because the file have has a change and you did not save.
Perhaps you added the line 16 and did not save, so for the compiler, the line 16 doesn't exist and same for the zipping program.
Can you save your file and try again?
removing the function definition in the cpp file
it will compilee the code that i checked
If my guess above is right then yes, removing the definition in the cpp would compile fine (I have also tried that with the zip file you shared and it worked for me too).
but even if i add function definition in cpp file it should compile right ?
If you only add a function definition in a cpp file but no function declaration in a hpp file, I don't thing it would compile.
However, having a function declaration in a hpp file but no function definition in cpp would compile.
Alternatively you could also directly do both the declaration and the definition of the function at once in the hpp.
I think the first step would be to save your project and try again to compile.
You can also unzip the file and sent me and you will see that there is no function declaration in the hpp.
Regards,
2025-05-02 9:09 PM
Got it sir!!!
It was not getting saved that was the issue
thank you soo much sir!!
2025-05-05 1:01 AM
My pleasure! :)
2025-05-06 11:14 PM
Where can i find more tutorials or resources to use communication protocols like UART,CAN to send data from others modules to the stm32h7 controller and then to the display
like i need to learn more in depth
i have seen stm32 yt lectures but all are not in order or in a playlist
its like all are mixed up there.
pls help me on this too
2025-05-07 1:24 AM - edited 2025-05-15 4:37 AM
Hello @Jerrythottathil ,
That is a great question.
ST made a wiki : st.com/content/st_com/en/support/learning/stm32-education.html
But it won't cover everything.
I was looking at the YouTube creator that I used to watch and I saw that Great Scoot had a "Electronics basics" playlist : youtube.com/watch?v=Y6ZND7Ed70k&list=PLAROrg3NQn7cyu01HpOv5BWo217XWBZu0
That could be a great start, he talks about I2C, SPI and probably other communication protocols.
Also, when I was looking for resources online I found this course (15€) : udemy.com/course/microcontroller-embedded-c-programming/?couponCode=2021PM20
From people's feedback it is great but mostly aimed at beginners.
Finally, there is https://stm32world.com/wiki/Main_Page that cover a large amount of subjects for STM32.
If you want to learn specific things, you best bet is to ask Google, YouTube or ChatGPT but you will mostly find beginner courses.
For more advanced information, you will have to get a good book.
Regards,