Dana Vrajitoru
C151 Multi-User Operating Systems

Homework 4

Due date: Monday, February 13, 2012.

Ex. 1. Create a folder called planets. Copy the following files to that folder:
/home/danav/public_html/teach/c151/planets/sun.h
/home/danav/public_html/teach/c151/planets/sun.cc
/home/danav/public_html/teach/c151/planets/earth.h
/home/danav/public_html/teach/c151/planets/earth.cc
/home/danav/public_html/teach/c151/planets/moon.h
/home/danav/public_html/teach/c151/planets/moon.cc
/home/danav/public_html/teach/c151/planets/main.cc

Alternatively, you can copy the entire folder in a single command using the option -R.

Write a Makefile that compiles each file separately reflecting the header file dependencies, and creates an executable called planet. Declare a variable called objects that contains the list of all the object files and use it in the compilation command that creates the executable. Add an entry to clean all the object files and the executable, and one default entry that links it all together. Add a comment with your name at the top.

Compile and execute the program using your makefile. Then modify the file main.cc using any editor you want to print out a message about the program before the one function call happening in it, then recompile the program with the command make and run it again. Copy these commands and their results in a file called hw4.txt.

Ex. 2. Add another section to the file hw4.txt and explain the following compilation commands (where l in -lmp3 is a lowercase El). What file will result from each of them?

g++ -c abcde.c -I/usr/include/mp3-2.1
g++ -o abcde abcde.o codec.o sound.o -lmp3 -L/usr/lib/mp3-2.1/ -g -w

Submit to Oncourse: the Makefile created for exercise 1 and the file hw4.txt.