CS115 Lab 2 Exercises:

Makefile Exercise

For this exercise you will need to debug a Makefile and add some targets to it. There is a zipfile with an incomplete calculator program with a Makefile. Transfer the file Calculatr.zip from the CS Dept's anonymous FTP site to your account space. Do that by:

  1. Entering the command:
    cp /net/data/ftp/pub/class/115/ftp/cpp/CalculatrPgm//Calculatr.zip Calculatr.zip
    
  2. OR, by using the command line FTP program using this information:
    The path:	pub/class/115/ftp/cpp/CalculatrPgm/
    The file:	Calculatr.zip
    		
    
    PLEASE avoid copying and pasting code. It makes a mess of formatting and may render the code uncompilable.

There are quite a few files in there to work with. Create a directory called Calculatr, move Calculatr.zip into it and then cd there. To extract the files from Calculatr.zip type:

unzip Calculatr.zip

There are 3 things you need to do with the Makefile to complete the exercise:

  1. The Makefile provided has an error. Type make to see the output. Not very helpful, but something happened near line 13. Since 13 is a blank line it's not likely the problem is there. Use your editor to fix the line above it and remember: Commands for targets must be tabbed. Spaces are not tabs.
  2. Test your fix by typing make once again. How many files compiled? Type make Calculatr. What happened this time? Create a new target just above the one that executed the first time to act as the default target. It doesn't need a command: its dependency will do all the work for you.
  3. It's always a good idea to clean up after yourself. Create one more target called clean that has the command rm -rf *.o.

gdb Debugger Exercise

Unix/Linux Command Exercise

You do not have to hand in your responses to the following, but there will be quiz questions later in the semester based on your understanding of these commands.

Enter commands as indicated below:


This page last modified:
Friday, 04-Jan-2008 12:26:03 CST

CS Dept Home Page
CS Dept Class Files
CS115 Lab Files

Copyright: Department of Computer Science, University of Regina.