2020 Spring CSCI251 Lab Preliminary
2020 Spring CSCI251 Lab Preliminary
Laboratory Preliminaries
I’ll go through some of this at the first lecture/tutorial.
This is preliminary material that should ideally be completed before the end of Week One of Spring
2020. It isn’t just of relevance to the labs, since it primarily relates to the environment that assignments
need to run in.
The environment you need to be able to connect to is a Linux server, capa.its.uow.edu.au, which
is running Ubuntu 18.04. You will need to become familiar with some Linux functionality as part of this
subject.
Note that you can get a IDE for whatever local environment you work in, so something like CodeBlocks
for example, but you need to make sure you understand how to access and use capa since assignments
need to be capa compliant and you should attempt to make lab work capa compliant too.
$ ssh [email protected]
Use your own username in place of username in the above, that’s some sequence of letters then digits. The
password will be your SOLS password.
Dr. Sifer suggested the following source of information for MAC users:
https://www.servermania.com/kb/articles/ssh-mac/
1
1.3 From Linux
Similar to the MAC. Use a terminal. Connect using
$ ssh [email protected]
Use your own username in place of username in the above, that’s some sequence of letters then digits. The
password will be your SOLS password.
There should be some sort of fingerprint test for this too.
File transfer can be done using sftp.
1. The terminal will open in your home directory. You can use pwd, present working directory, to
determine where you are at any particular time.
$ pwd
/home/staff/l/lukemc
Note that $ is the default command prompt. When you see that, you can enter a command.
2. It’s a good idea to organise the material for each week into a directory. It is helpful know a little bit
about moving around directories, the following should help.
5. The source files, likely in a zip file, may need to be put it into the lab directory you have just made
for the week.
6. Within the terminal, look in a directory using ls, or ls -la for more detail.
$ ls
$ ls -la
7. With text files you can read them using something like cat or less or more.
8. Long term, learn to use an Ubuntu editor. Likely pico. You can write source files on your local
machine and transfer them across to capa.
2
3 Part Two: Compilation
1. Open an editor to make a source file Hello.cpp. For example, if you are using pico, type
$ pico Hello.cpp
2. Type the following code into the editor. Please don’t copy and paste. I expect you will make some
mistakes in typing and it’s helpful to learn how to move around in the editor.
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
3. To save in pico you use Ctrl-o. To exit the editor use Ctrl-x.
4. You compile Hello.cpp using the following instruction, remembering that this is in the terminal
window with your location being wherever the file Hello.cpp is.
$ g++ Hello.cpp
5. The default name for the executable is a.out. Use the argument -o name to specify a new name.
$ ./a.out
$ ./Hello
c Luke McAven, SCIT-EIS-UOW, 2020.