DDD to find segmentation faults Review compile/link process slide Why not put Word in a single source file? General rule: One class per file Split class into .h and .cpp [Stack example] Separation of Interface and Implementation .h = info needed by users of the class (interface) .cpp = class implementation #include relationships between impl and header files .cpp includes its own .h .h includes other .h's it depends on .cpp includes other .h's it needs that its .h doesn't include Multiple inclusions [Stack example] #define, -Dsym=value conditional compilation #ifdef, #ifndef protecting header files with #ifndef Large projects contain many files of different kinds [Stack example] source header, impl test build object files binaries exe test exe's data config test documentation libraries e.g., separate directory for each library Locating header files [Stack example] g++ -I Multi-step compiling/linking [Stack example] g++ *.cpp doesn't work on large programs .cpp files are compiled individually only those classes that have changed are recompiled g++ -c g++ -o Static Libraries [Stack example] In what form would you provide your code to customers? .o's and .h's Static library packages .o's into a single file Compiling/linking static libraries