Lecture Notes for Introduction to Computer Science II

3 July 2001 - Files and Compilation


  1. files - source, object, and executable

    1. compilers produce object from source

    2. linkers produce executable from object

    3. the compiler usually hides the linker

  2. source files - program text; human readable and writable

  3. object files - machine code; pieces of programs; machine readable

  4. executable files - more machine code; whole programs

  5. identifying files

    1. extensions to file names

      1. source (.cc, .cpp, .C, .h)

      2. object .o

    2. magic cookie in the file

      1. /etc/magic

    3. both used by most systems

  6. convention - not enforced but expected

    1. people and software get confused if you don't follow conventions

    2. know and understand them before ignoring them

  7. c++ source files

    1. .cc - c++ source files - code

    2. .h - c++ header files - definitions (type, global, class, const)

    3. putting code in .h file is frowned upon - but templates

  8. c++ include files - c++ standard, c standard, the rest (quasi standard)

    1. c++ standard includes don't have the .h

      1. #include <iostream>

      2. can have the .h - but <string> is not <string.h>

    2. c standard includes don't have the .h and have a c in front

      1. math.h - #include <cmath>


This page last modified on 23 July 2001.