I have 3 files, main.cpp, header1.h and header2.h.

header1.h only contains a variable: int hello
header2.h also contains the variable: int hello

main.cpp includes both headers, when I compile it says multiple definition.

I know why it does that but I was wondering, is there any way to make the definitions in the header files local to the actual file but global to the functions in it?

For example:

header1.h:
Code:
int hello;

void func1()
{
...
}

void func2()
{
...
}
both the functions in header1 need to use the variable hello,
and in header 2:
Code:
int hello;

void func1()
{
...
}

void func2()
{
...
}
both the functions in header2 also need to use the variable hello.
I cannot combine both header files into 1 header because Im splitting the sections of my code into headers in order to update it faster.

Is there anyway to make the definition of hello in both the headers invisible to main.cpp? but only allowing main.cpp to see the definitions of the funcs and being able to use them.