Headers not found

I am having trouble getting headers recognized…appreciate any help. I want to have a global header that defines class variables that are used in both libraries and main loop. I use the timer class and LiquidCrystal class and the instantiated objects need to be accessible by a library and within the main loop. My strategy is to create a global header with all the includes and defining the variables as extern in the global header, and declaring them in the .ino file. The idea is that by defining them in the global header, all .cpp files will recognize them. By declaring them in the .ino file, they will only be instantiated once. I’ve been hacking away for a while and am still not getting it to work.

A turned on the verbose errors and it looks like the headers are not being seen. i’ve tried adding them to the project, adding them as libraries, still not working. Appreciate any direction you can give. Below is the global header, the start of the .ino file, and the verbose error showing headers not recognized. I did try using quotes instead of <>…no change. The attached .doc file has the same info as below plus an image of the project solution

Thanks in advance…jimf

Below is the header with the globals

/ PondMonitorGlobals.h



#ifndef _PONDMONITORGLOBALS_h
#define _PONDMONITORGLOBALS_h

#if defined(ARDUINO) && ARDUINO >= 100
	#include "Arduino.h"
#else
	#include "WProgram.h"
#endif
#endif
#include <inttypes.h>
#include <Event.h>
#include <Timer.h>
#include <Menu.h>
#include <LiquidCrystal.h>

extern MenuClass menu;
extern Timer Tmr;	// timer object used for polling at timed intervals
extern LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

Below is the start of the .ino file that includes the global header and instantiates the variables

#include "PondMonitorGlobals.h"


//Declare global variables, defined in PondMonitorGlobals.h.  These are available to other modules
Timer Tmr;	// timer object used for polling at timed intervals
MenuClass Menu;
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

Build showing errors

Sketchbook: file:///C:/Users/Jim%20Frankfort/Documents/Arduino
Core Include Paths
Include Path ‘C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino’
Include Path ‘C:\Program Files (x86)\Arduino\hardware\arduino\variants\mega’
C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-g++ -c -g -Os -fno-exceptions -ffunction-sections -fdata-sections -Wall -mmcu=atmega2560 -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=106 -I"C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino" -I"C:\Program Files (x86)\Arduino\hardware\arduino\variants\mega" -o “C:\Users\Jim Frankfort\AppData\Local\V.Micro\Arduino\Builds\PondMonitor1\mega2560\Menu.cpp.o” “C:\Users\Jim Frankfort\AppData\Local\V.Micro\Arduino\Builds\PondMonitor1\mega2560\Menu.cpp”
PondMonitorGlobals.h:15:19: warning: Event.h: No such file or directory
PondMonitorGlobals.h:16:19: warning: Timer.h: No such file or directory
PondMonitorGlobals.h:17:18: warning: Menu.h: No such file or directory
PondMonitorGlobals.h:18:27: warning: LiquidCrystal.h: No such file or directory
PondMonitorGlobals.h:20: error: ‘MenuClass’ does not name a type
PondMonitorGlobals.h:21: error: ‘Timer’ does not name a type
PondMonitorGlobals.h:22: error: ‘LiquidCrystal’ does not name a type
Menu.cpp:14: error: ‘MenuClass’ has not been declared
Menu.cpp:14: error: ISO C++ forbids declaration of ‘MenuClass’ with no type
Menu.cpp:In function ‘int MenuClass()’
Menu.cpp:17: error: ‘MenuPos’ was not declared in this scope
Menu.cpp:19: warning: no return statement in function returning non-void
Menu.cpp:At global scope
Menu.cpp:21: error: ‘MenuClass’ is not a class or namespace
Menu.cpp:36: error: ‘MenuClass’ is not a class or namespace
Menu.cpp:42: error: ‘MenuClass’ is not a class or namespace
Menu.cpp:58: error: ‘MenuClass’ is not a class or namespace
Menu.cpp:74: error: ‘MenuClass’ is not a class or namespace

Solution setup image in attachement

Build error.doc (52 KB)

#include <inttypes.h>
#include <Event.h>
#include <Timer.h>
#include <Menu.h>
#include <LiquidCrystal.h>

For the Arduino IDE to generate the correct include path statements for the compile, you need to put these inside your .ino file directly, not “hide” them in another include file.

For the Arduino IDE to generate the correct include path statements for the compile, you need to put these inside your .ino file directly, not "hide" them in another include file.

Actually, you need them in both places. Compiling the library and compiling the sketch are two different compilation units, so the include files need to be in the library header file for the library to compile. They need to be in the sketch for the build process to know that it needs to copy them to the build directory so that they are available during the compilation processes.

By the way, the end of your include guard is in the wrong place.