Header files should look like
#ifndef _MY_HEADER_FILE_NAME_H_
#define _MY_HEADER_FILE_NAME_H_
/* include all headers whose types you need */
#include <Arduino.h>
/* define macros */
#define VERSION 0x010203
#define MANIPULATE(x) ((x) + 1)
/* declare global variables */
extern int myGlobalInt;
extern String myGlobalString;
extern char myBuf[1500];
/* declare global functions */
String my_global_function(int a, int b);
#endif /* _MY_HEADER_FILE_NAME_H_ */
And the corresponding cpp file should look like
#include "myHeaderName.h"
/* define global variables once */
int myGlobalInt = 123;
String myGlobalString = "ABC";
char myBuf[1500] = {0};
/* define global functions once */
String my_global_function(int a, int b) {
return String(a + b);
}
General C/C++ tutorials already cover this, e.g.,