Click here to Skip to main content
15,886,963 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to create a global variable that can be used in all ScreenViews in CubeIDE.

What I have tried:

I have tried to:
  • create this variable in Screen5View in public: in hpp
  • create a new header file, name it globals.h and create a variable there

The error is always the same.

"fatal error: globals.h: No such file or directory" or that the int was not defined.
Posted
Updated 28-Aug-23 8:05am
v2

The error message is pretty clear:
Error
globals.h: No such file or directory
And it means what it says - the file globals.h is not in any location that the compiler is checking.
Start by finding the file, and compare its location with the rest of your source code. If it's not in the same folder, you need to add that location to
Menu
Project Properties ... C/C++ Build ... Settings ... Tool Settings ... MCU GCC Compiler ... Include Paths
 
Share this answer
 
Comments
Member 16074047 28-Aug-23 2:44am    
the globals.h file is in gui folder where all the other screen views are located...

update: I think I found the solution holdup.

I have to find where all the other header files are located. Will do that now.
I have located where all of my other header files were.
-gui
-include
-gui
-include
-common
and made a notepad and wrote the code there. Than I included the following line in header file of screen5view and screen2View where I wanted the variable to be used


#include <gui common="" globals.hpp="">
 
Share this answer
 
Comments
OriginalGriff 28-Aug-23 3:17am    
Don't do that. Add the path to your project headers files to the project settings as I said in my reply.
If you go down your route, then the next project you create will generate it's own globals.h file which you will need to overwrite this projects with - so this project will then fail to build when you need to make changes later.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900