|
Several stages are required to build an executable program; Microsoft Visual Studio .NET helps by automating them. To examine and understand these stages, however, let’s look at them briefly. You’ll see these stages again later in the chapter when we build our first program.
Before you can create a program, you must write something! Visual Studio .NET provides an integrated C++ editor, complete with color syntax highlighting and Microsoft IntelliSense to show function parameter information and word completion.
The C++ compiler is the tool for converting textual source files into machine code object files that have an .obj file extension. (Object in this sense is not to be confused with object-oriented.) The compiler is invoked inside the Visual Studio .NET environment, and any errors or warnings are displayed in the environment.
However, the object files produced are not executable files. They are incomplete, lacking references to any functions not contained with the source files for the particular compilation.
The final step in producing an executable file is to link together all object files that make up a particular project. This linking includes not only object files produced from your own source code, but also object files from system libraries such as the C++ standard library or the Microsoft Foundation Class (MFC) library.
Link errors tend to be less helpful than compile errors. Compile errors will give the file name and the line number of the error; the linker will give only the name of the object file, so a bit of detective work is often required.
System and class libraries often have many .obj files associated with them. Handling all of a library’s object files in a project would soon become onerous, so .obj files are frequently combined into .lib library files for convenience.
Although linking might be the final step in creating an executable file, it’s not the last step in development. You still need to run and test the program.
For many development environments, running and testing is often the most difficult part of the program development cycle. However, Visual Studio .NET has yet another ace up its sleeve—the integrated debugger. The debugger has a rich set of features to allow easy run-time debugging, such as setting breakpoints and variable watches.
|