cancel
Showing results for 
Search instead for 
Did you mean: 

Including headers to a touchGFX porject? What to write in the makefile?

Fishmaster257
Associate III

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:

https://community.st.com/s/question/0D50X0000BJ22vx/how-to-manually-add-include-path-to-touchgfx-designerwindows

https://community.st.com/s/question/0D53W00000TEpmmSAD/how-to-add-nontouchgfx-header-and-source-files-to-touchgfx-makefile

I tried to include the header path in the makefile like this (I have no clue on how to code a makefile):

0693W000006I67rQAC.pngis also tried:

0693W000006I69EQAS.pngthis is how it looks like in CubeIDE:

0693W000006I681QAC.pngI 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:

0693W000006I6PMQA0.pngAs 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:

0693W000006I6QUQA0.pngUsing 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!

1 ACCEPTED SOLUTION

Accepted Solutions
MM..1
Chief II

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>

View solution in original post

2 REPLIES 2
MM..1
Chief II

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>

Thanks, method B works perfectly.