Your first post suggests you're creating the .exe just by copying the source file. This isn't the way to create an executable. Download a hex editor (e.g. xvi32) and have a look at an executable. Be careful not to change anything, or if you do either don't save the file or make a backup of the original executable before you save it. See how it looks nothing at all like source code? (Keep xvi32 installed, hex editors are spectacularly useful to programmers.)

This is because source code must be transformed into an executable. This is done in several steps. First, the C preprocessor preprocesses the files, mostly looking for comments and lines beginning with #. The preprocessor sorts out header files and simplifies the code for the compiler. The compiler usually invokes the preprocessor for you, and sometimes the preprocessing is done by the compiler itself, so normally you don't need to worry about this step. But it can occasionally be useful to invoke the preprocessor directly.

Next the compiler takes the preprocessor output and compiles it into what is known as object code. This is like executable code but has not yet had all its references finalised -- meaning, if, say, your program calls printf(), any calls to this function have not yet been resolved.

Next, the linker takes the object code, possibly from several compiled source code files, and the libraries, and links them together, resolving all references, and produces an executable.

So let's have an example. Here's a header file, let's call it dave.h:

Code:

#define FOO 27
void func(int x);

The main program file, dave.cpp:

Code:

#include "dave'h"
int main()
{
func(FOO);
return 0;
}

And a second source file func.cpp:

Code:

#include "stdio.h"
void func(int x)
{
printf("x=%d\n",x);
}

We can see all this in action with the above. I have a machine with MinGW installed; let's use that. MinGW is Minimalist GCC for Windows; there are other compilers, but this is a good free one.

When learning, use the command line. IDE's are good, but they hide a lot, which is useful when you're up and running, building complex executables from multiple source files and libraries, but learning in an IDE is bad on two counts: (1) you don't get to see what's really going on (e.g. in Visual Studio you just hit F7 and there's the executable); (2) that ties you to a specific IDE and you have an unnecessarily steep learning curve when you encounter a new IDE. IDE=Integrated Development Environment.

So let's say the above files are in c:\dev, and MinGW is installed in c:\MinGW, and you've opened a command prompt in c:\dev.
Compile dave.cpp with the command: \mingw\bin\c++ -c dave.cpp -o dave.o
Compile func.cpp with the command: \mingw\bin\c++ -c func.cpp -o func.o
Link the two files with: \mingw\bin\c++ dave.o func.o -o dave.exe

All being well there won't be any errors (I've worked through this as I've written it so there shouldn't be) and you'll now have dave.exe. Run it just by typing its name (dave), and you should get the output:
x=27

Now you've done all that, here's a shorter version of the same. Delete dave.exe, dave.o and func.o, and build the whole lot in one step with:
\mingw\bin\c++ dave.cpp func.cpp -o dave.exe