Multi File Projects

This is a discussion on Multi File Projects within the C++ Programming forums, part of the General Programming Boards category; I'm looking for possible help or tutorials about using a
Multi File Source Code, the whole program uses each other's
...

I know how to include and link etc.
I want to know how to combine different c++ sources,
with the declarations in the headers,
And how to connect them, i know how to do that as well
but only if they don't use each other's variable, that's
what i want to accomplish

I think i´ve seen #include in some source codes. Consider you have three separate files: main.cpp vars.cpp and functs.cpp. In main.cpp you have the main() function, in vars.cpp you have all the variables and in functs.cpp you have all the other functions you need for your program. You could write this at the heading of the main.cpp file:

Code:

#include functs.cpp //file with the functions
#include vars.cpp //file with the variables
main()
{
// the rest of the code here...
}

That's not the way you should use CPP files, ive intregrated them
into my project and thus linking it together with other sources,
But i just need a tutorial on using multi file sources, it arent just
peaces of code that i 'add' in my source they all cooperate

So i need to use the variables in main.h in main.cpp and
monkey.cpp, however if main.cpp is compiled main.obj contains these, and if monkey.cpp compiles, it errors up
saying that main.obj alerady has these! how can i get monkey.cpp to use main.cpp's variable's?