Ok, this is probably some simple problem to fix, but I cannot figure out what is wrong with it.

What is happening is that when I put some functions and globally define any variables in my programs (in separate files from my 'main.cpp') and #include them, the compiler/linker are telling me that I haven't declared them yet, but I know I have because they are right there. It doesn't matter where I put them either it always tells me that they are "undeclared".

I'm using VS .NET 2003 (VC/C++ 7) and this is how i'm doing it:
Code:
file: main.cpp**************

int myglobalinteger=0;

#include "myfile.cpp"

void main()
{
  //blah
  //do something with mydirectxobject
  mydirectxobject->method1();
  myfunction();
}
************************

file: myfile.cpp*************

(some microsoft macro for a typedef) mydirectxobject = NULL;
void myfunction(int someparam)
{
  //do something with myglobalinteger
  myglobalinteger+=1
}
************************
It gives me an error when i try and access any global variable/object that is not in the current file. Have I done something wrong, or is Visual Studio being a pain again?