I am currently googling this, but I don't know how to word it. I suspect someone will point me to a duplicate question. But... if I have a file like so
parent.h:
...
include "child.h";
int foo;
...
and the following source file, which is called above via its header file:
child.c:
int display ()
{
printf ( "%d\n", foo );
}
Now this is a simplified example, currently I am using C++ and I am creating an object, and that object calls a method of another object, like foo declared in the parent file. Naturally I get the following error:
error: ‘foo’ was not declared in this scope
Is there any way to get around this scope issue, or must I pass foo down as a parameter?