A picture says more than thousand words ...
This figure tells you that one or more source files are transformed to object files and via the linker transformed again to an executable program. The steps below dives into this process.
Basically any C or C++ program contain one or more of these types of files, commonly called source code:
So if you see that an application is shipped with the source code, or one of your colleguages asks for the source code of your new marvel application, you know what files he or she wants!
You can think of source code as the recepie for a meal. Without it, no meal!
The main purpose of a compiler is to transform the source code, which in our case is either based on the C or C++ programming language, into a one or more "middle layer"-type of files called an object files. The object files contain a low level format of your code, which the next step in the process understands. You cannot run or execute object files.
You can regard object files as half-baked bread, almost ready to eat.
The linker gather your object files and combine them with run time libraries and product libraries of all kinds. The result is an executable file, DLL or Library, which can used on the designated operating system.
When you make an application it is unlikely that it wont contain any bugs (errors), at least in the beginning. Lets face it, even commercial applications has bugs of different severity and with different impact.
To help you find those bugs before you ship your product, you can create a special variant of your application, often referred to the debug-build. The debug-build contains lots of debugging aids such as memory validators, source code to help identifying errors with the code you have used, and not the pretty unreadable machine code etc etc. This extra payload increase the size of the executable file considerably, and debug-builds also turn off all kinds of automatic optimalizations. All this to aid you finding those bugs!
By using a special tool shipped with Visual Studio called the debugger, you can look at your code while it runs, and you can monitor and change the contents of the variables etc. If your application crash while "you're in" the debugger (the process of debugging), it will very often tell you the exact location of the crash in your source code. You also have the ability to see the sequence of function calls etc at the crash point.
The debugger is indispensable finding bugs and you will spend some time it it - believe me!
What do you do when you don't find any more bugs ? Well, maybe it's time to create the release-build. This is the executable file that you ship to customers or make available on your homepage. A release-build have stripped off all debug-info, and turned on all kinds of optimalizations. The executable file is therefore often quite small in size, and it performs like a racer!
You will see the notion of debug- and release builds throughout the course!