To produce an object file from a source-code file, you issue a command to
the compiler with the -c
option. In the following, for example, the
compiler and linker, which happens to be named CC
, produces a
trains.o
file:
CC -c trains.cxx
If you wish, you can produce several object files at once. In the following, for example, you produce three object files as though you had issued three commands to the C++ compiler.
CC -c trains.cxx containers.cxx cars.cxx