Lab 1 - Using Sleipnir and Basic Compilation

Attendance is required to get credit for this lab. This lab will be a mix of lecture and demonstrations.

Part 1: Using Sleipnir

If you did not attend CMPS 150 or 215, see me for your account information sheet, which has your username and password for Sleipnir. If you did attend CMPS 150/215, be sure to remember your username and password or bring the account information sheet to the lab.

This section of the lab will review pertinant concepts from 150/215 about how to log into Sleipnir, manipulate files and send emails. I'll also show you how to secure your files so that other students cannot read them.

Refer to my connection guide for more details on how to connect to Sleipnir and log in.

Part 2: Basic Compilation

For this section of the lab, I'll describe what is involved in compiling a program (from Chapter 1 of the book) to create a sequence of instructions that the computer can execute. I will show you how to use the g++ compiler on Sleipnir to compile a simple "Hello world" program (hello.cpp).

To copy hello.cpp to your Sleipnir account, use pico to create a file called hello.cpp (vi requires special commands for cut-and-paste operations. I will show you how to do that in a later lab). Highlight all of the Hello world program in Firefox, then switch over to the terminal and click the scroll wheel (just click, don't scroll) to paste onto Sleipnir. Save and exit pico by pressing CTRL+X and following the prompts.

To compile the hello.cpp source code file, issue the following command on Sleipnir:

g++ -o lab1 hello.cpp
This will create an executable called lab1. If you pasted the code correctly, there should be no syntax errors. To run the executable, give the following command:
./lab1