Indeed, a very rough analogy would be to consider each .cpp file as a different house and each header (.h) as a phone, or maybe phone number. For one to talk to the other it needs the right header.
you will need to #include "DarkSDK.h" in any cpp that uses sdk commands.
To use functions from one cpp file in another you need to prototype the function in a header and #include the header in the cpp you wish to use the function in, example:
moo.cpp:
int moo(int a, int b) {
return a + b;
}
moo.h:
main.cpp:
#include "DarkSDK.h";
#include "moo.h";
void DarkSDK(void) {
dbSyncOn();
dbPrint(dbStr(moo(2, 2)));
dbWaitKey();
return;
}
that would call the moo() function from moo.cpp and use it to print the result 4. if main.cpp DIDNT include moo.h then it would complain that moo() was undeclared.
variables can be sort of prototyped in a simular way using the keyword "extern" which stands for external. its like an uber global.
declare your variable like normal in moo.cpp, say
int a = 5;
then in moo.h you add:
extern int a;
then any cpp file which you want to have access to a you would include moo.h so it can read the extern declaration.
remember, the proper declaration in the cpp (not the extern in the header) should be declared in global scope, not inside a function. Personally i think you should minimise externed vars because it can quickly get messy. It might be worth externing all global vars from all cpp files in a Globals.h as thats one way to make it more tidy.