CS-321 Computer Graphics
Lab 1: Introduction to Linux

Overview

All of the laboratory assignments for this course will be completed on a Linux operating system. In this lab, you will attain or review basic skills for interacting with Linux. This year, CCSD has configured your laptops such that you can run Linux from within an emulation environment within Windows XP by using an emulator called VMWare Player.

The main objective of this lab is to familiarize yourself with the Edit-Compile-Run cycle of development of C++ programs in the Linux environment, as well as some of the basic features of the Linux operating system.

Assignment (to be completed in the lab session)

Prep

First, listen to my long-winded explanation about the history of unix, and how it was created by a bunch of really smart guys - all of whom seem to have had beards - while their managers (probably clean-shaven) were looking the other way. I've never been able to cultivate any cool facial hair, so....

Next, install the development tools (C++ compiler & related) you'll need for the remainder of this course. As in CS280, we'll be using the GNU open source compiler. None of these tools are on your system by default; you have to run the Linux-style installation programs to load them on. You do this by issuing the following two commands from within a command-prompt window, cleverly called Konsole in this particular Linux desktop environment. You can find it within the Linux equivalent of the startup menu, called the K Menu. The required kommands are

sudo apt-get update
sudo apt-get install gcc g++ make libqt3-headers libqt3-mt-dev

While your are within Konsole, try the ls command, which will probably not be familiar to you as a Windows user. It is a useful command to get to know. Figure out how to generate a detailed directory listing using the options available with this command. You will find that there are many more commands available within Linux as compared to Windows. Most of these have been around for decades; they originated in the unix era when the Beatles were popular and the console window was the only interface to the operating system - before there were graphical user environments.

You may wish to take a look at Unix is a Four Letter Word, a unix manual that Dr. Taylor wrote as a summer intern some years ago. He presents a brief tutorial on how to use the most common commands.

Procedure

Download the following files either to your Windows host or directly to the Linux VM. If you download to the Windows host, you'll have to use the network shared drive mechanism to transfer them to the Linux file system. Put them in a convenient place within the Linux filesystem, like /home/<your login name>/cs321/lab1. Note you'll have to create the cs321/lab1 directory within your home folder of /home/<your name>, which already exists.

cs321lab1.cpp

pixelcalc.cpp

pixelcalc.h

lab1.pro

From the Konsole window, change directories to /home/<your login name>/cs321/lab1. Hint: The cd command originated in unix. At the Konsole prompt, type

qmake lab1

The qmake utility processes the lab1.pro file and creates a Makefile - a set of rules that specify how to compile and link the source files.

From the Konsole prompt, type

make

The make utility processes the rules within the Makefile. You'll get some compiler errors that have been intentionally introduced to make you angry. Really, they're to refresh your memory of C++. Fix the errors using an editor, which you can launch by double-clicking on the .cpp files from within Konquerer (the graphical file/internet browser). The Kate editor is associated with .cpp files and will be launched so that you can edit the files. If you are 1960's retro, you can use a text-based editor like nano or vi, which you can launch from Konsole.

After you fix all of the errors, the make utility will create an executable file called cs321lab1 (with no file extension - this is the convention in Linux). From the Konsole window, type

./cs321lab1

This will launch the application and produce some output on the screen. Demonstrate this and the detailed version of the ls command to your instructor. Once you demo, your done!

No lab report is necessary for this lab. Keep the files around - you'll need them later on.