2021-09-28 10:38 AM
Hello community
I face the following problem
I have a global data structure which contains several member variables, I use this data structure to handle all my global variables needs across my project.
Such datatype is delcared in "globals.h", and a variable using this datatype is declared in "globals.c" and exported as extern always in globals.h.
I want to assign some of these variables when TouchGFX interactions happen (like moving a slider or pressing a button) in my TouchGFX "view"
The problem is, if I include globals.h in my "view.cpp", then the TouchGFX simulator won't build as it cannot find "globals.h".
for sake of simplicity
globals.h
typedef _myType{
int sliderValue;
}myType;
extern myType myGlobalVar;
globals.c
#include "globals.h"
myType myGlobalVar;
How should I access my global variables then without breaking the interface simulator?
Matteo
Solved! Go to Solution.
2021-09-29 01:44 AM
Hello Matteo,
Strange, space should work.
You can also write as follows :
folder/folder/file1.c \
folder/folder/file2.c \
folder/folder/file3.c
Make sure the path to your file is correct.
/Alexandre
2021-09-28 07:22 PM
Hello Matteo,
globals.h is not known by the simulator so it cannot compile it.
To add c/h files to a simulator project, go to <your project>/TouchGFX/simulator/gcc/ and edit the Makefile
Add your globals.h/.c file path as follows
ADDITIONAL_SOURCES := <path_to_globals.c>
ADDITIONAL_INCLUDE_PATHS := <path_to_globals.h>
/Alexandre
2021-09-29 01:37 AM
Thank you Alexandre, can you also tell me what would be the synthax to add multiple include paths and source files? I tried to separate them with white spaces or -I but it does not work :grinning_face_with_sweat:
2021-09-29 01:44 AM
Hello Matteo,
Strange, space should work.
You can also write as follows :
folder/folder/file1.c \
folder/folder/file2.c \
folder/folder/file3.c
Make sure the path to your file is correct.
/Alexandre
2021-10-01 05:42 AM
Thank you for your support you have been very kind! my problem is that I was not escaping the ":" char correctly now I use
"../" to address the makefile to the project folder when adding sources
Matteo