Table of Contents        Previous topic       Next topic       

C COMPILER->Running the Compiler from the Command Line

The C compiler is run from the command line with the command:

CL [sfiles] [/options]
where [sfiles] is a list (separated by spaces) of source files to be compiled
and [/options] is a list (separated by spaces) of compiler, cross assembler and linker options.

The filenames and options may be in any order on the command line but note that the first filename is used to create the filename for the program code.

The C source filenames must have an extension otherwise they are assumed to be object files which are included in the link but are not compiled.  If a file has the extension .ASM it is assumed to be an assembler code file and the cross assembler is invoked to assemble it.

Each source file is compiled (or assembled if the file is an assembler code file) to create a relocatable object module.  This object module is placed in a file whose name is the same as that of the source file but with a .OBJ extension.

Unless the /c option is used, these object code files will be linked to create the final target program (by default in Intel hex format).  A default library file is automatically searched for any unresolved references.  If you have used any floating point objects (float, double or long double), then a default floating point library file will also be searched.

The default library files will depend upon the memory model specified and whether non-reentrant or reentrant code is selected as the default.

The filename used for the target program is the same as the first source filename but with an extension which reflects the file output format (.HEX, .OMF, .S19, .695, .ASC or .BIN).

The link map is placed in a file with a filename constructed from the name of the first source filename but with a .MAP extension.

The compiler options are described in the following section.  See the section describing the cross assembler for the cross assembler options and the section describing the linker for the linker options.

An example command line is:


This command line will compile files MAIN.C and CALCS.C to produce object files MAIN.OBJ and CALCS.OBJ.  File IO.ASM will be assembled to produce object file IO.OBJ.  Files MAIN.OBJ, CALCS.OBJ, IO.OBJ and TIMER.OBJ are then linked to produce program code file MAIN.HEX and a link map file MAIN.MAP.

/Fc is a compiler option and this causes the compiler to create commented assembly code listings for the C files in MAIN.LST and CALCS.LST.  (The cross assembler also creates a listing file IO.LST but this is created whether or not the /Fc option is used.)
/NOROM is a linker option which tells the linker to place the program code in the same memory space as external data.

/DDEBUG causes the identifier DEBUG to be defined.

No memory model is specified and so the compiler will default to the large memory model.  No non-reentrant/reentrant type is specified and so the compiler will default to non-reentrant code.