Lecture Notes for Introduction to Computer Science II
3 July 2001 - Files and Compilation
- files - source, object, and executable
- compilers produce object from source
- linkers produce executable from object
- the compiler usually hides the linker
- source files - program text; human readable and writable
- object files - machine code; pieces of programs; machine readable
- executable files - more machine code; whole programs
- identifying files
- extensions to file names
- source (.cc, .cpp, .C, .h)
- object .o
- magic cookie in the file
- /etc/magic
- both used by most systems
- convention - not enforced but expected
- people and software get confused if you don't follow conventions
- know and understand them before ignoring them
- c++ source files
-
.cc
- c++ source files - code
-
.h
- c++ header files - definitions (type, global, class, const)
- putting code in
.h
file is frowned upon - but templates
- c++ include files - c++ standard, c standard, the rest (quasi standard)
- c++ standard includes don't have the
.h
-
#include <iostream>
- can have the
.h
- but <string>
is not
<string.h>
- c standard includes don't have the .h and have a c in front
-
math.h
- #include <cmath>
This page last modified on 23 July 2001.