2021-01-09 08:42 AM
Hello,
as many before I am wondering how to add custom headers to a project generated by TouchGFX. I have read a few forum posts like these:
I tried to include the header path in the makefile like this (I have no clue on how to code a makefile):
is also tried:
this is how it looks like in CubeIDE:
I want to include the folder LEDs with my two needed headers. Could someone pls write some "Makefile examplecode" on how the include path hast to look like?
Also for better understanding, why isn´t simply adding a new header to the project viable?
It works for c files but not for headers an it also works for non TouchGFX projects. I simply copied the header code to my declarations before my main function and the functions defined in my c file worked as expected (e.g SK6812.c)
Thanks!
EDIT:
MMs solution works! To make it easier for others I will post some screenshots below, since I had to look around a bit until I had found it:
First right click on your project (e.g. STM32F469l-DISCO) and go to propertiers. A new window should open, looking like this:
As you can see go to C/C++ Build, select Settings and then choose Tool Settings in the top toolbar. You can already see the Include Paths marked with the red arrows.
Next up select the Include Path you want to use, this will lead to the following screen:
Using the small button in the top right corner you can add your own path. It works like any other directory, simply select the prefered folder an click on add. (e.g. C:\TouchGFX\MyApplication\STM32CubeIDE\Application\User\LEDs)
I hope this makes it easier for anyone searching for include paths!
Solved! Go to Solution.
2021-01-09 11:26 AM
When you build and use CubeIDE then you need differ how you create project
A. as new project with CubeIDE wizard
B. as import existing TouchGFX project
for B is add little complicated but simply open project properties open build settings tool settings and in C and C++ parts setup new include paths
for A. simply dont create new folders and place C files to core/inc and core/src (use refresh project when copy externaly)
C++ files place to gui part in screen folder or separate then in hpp use for example #include <gui/screen1_screen/Gauge.hpp>
2021-01-09 11:26 AM
When you build and use CubeIDE then you need differ how you create project
A. as new project with CubeIDE wizard
B. as import existing TouchGFX project
for B is add little complicated but simply open project properties open build settings tool settings and in C and C++ parts setup new include paths
for A. simply dont create new folders and place C files to core/inc and core/src (use refresh project when copy externaly)
C++ files place to gui part in screen folder or separate then in hpp use for example #include <gui/screen1_screen/Gauge.hpp>
2021-01-09 11:42 AM
Thanks, method B works perfectly.