Compiling Separately

There are no standards for compiler or linker command names. The following commands compile the modules and link them together using a fictional compiler (cppcompiler) and linker (cpplinker) under Windows:

|compiling|commands

|commands|compile

cppcompiler PromptModule.cpp
cppcompiler ErrorHandlingModule.cpp
cppcompiler Main.cpp
cpplinker Calculator.exe Main.obj PromptModule.obj ErrorHandlingModule.obj

A compiler typically produces an intermediate file, whose name often ends in .obj or .o (it is sometimes called an object file even though it has nothing to do with object-oriented programming). The linker combines these files into an executable file (under Windows a .exe file, under Unix a file with no extension). The operating system will be able to run this executable file.

Now, if you change only the ErrorHandlingModule, you can compile it alone and link it with the others:

cppcompiler ErrorHandlingModule.cpp
cpplinker Calculator.exe Main.obj PromptModule.obj ErrorHandlingModule.obj

The other modules may have been last compiled days earlier. In a large system with tens or hundreds of modules, this can be a time-saver.

For your compile and link commands and their options, see your compiler documentation.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.1.15