While there is information on how to compile and execute programs,
if you have not used Linux before, the instructions are not thorough enough,
so it is best to wait until a brief demonstration is seen in lecture or
via a video. Don't worry if you are not familiar with Linux.
Obtaining software to (1) get a secure connection, (2) to transfer files, and (3) for a terminal window
First, you need software that will provide you with a secure connection
to the UW network if you remotely connect. If you are on campus,
you don't need to use the secure connection software.
(1) Secure connection software:   use software links from the  
Download and Use Husky OnNet page
     
Follow the instructions for how to use it on that web page
(search for f5 after it is installed).
Then you need two different software applications: one to transfer files and
the other to get a terminal window to compile, etc.
Any software will do. Below are the ones used in the CSS labs.
If you use VS Code, you likely do not need these.
Skip to ">>>>>>>Now everyone"
(2) Secure File Transfer software:   use software links from the
 
UW IT Connect page.
     
If you have a windows machine, use Win SCP.
Mac users like Filezilla.
(3) Secure Terminal Window:   most people use
putty .
(If you use a mac, you don't need putty.)
Obtaining lab1 output on our Linux machines
When using the linux machines remotely, you MUST
first connect the f5 BIG-IP Edge Client software (secure connection
software, OnNet software).
Transfer files:
Then to transfer files onto the Linux machines remotely, use the
secure file transfer program you installed (WinSCP, Filezilla, or whatever) on
port 22 with one host address, any of
      csslab1.uwb.edu, csslab2.uwb.edu, up to csslab12.uwb.edu
Use your UWNetID and password to log in.
Transfer (drag and drop) your .h, .cpp, and any data files to the Linux machine.
Do NOT transfer your whole project as you have limited space and project
files are big.
Note that when you are on campus, you don't need to use f5.
You can find additional information about the Linux machines on the
CSS wiki:
Lab Linux Guide
Here are some detailed instructions on
how to transfer files and compile under Linux
and some
basic unix commands and information for use in the terminal window.
Compile and execute:
Windows: Use the secure window terminal software
you installed (putty) and some host machine, e.g.:
    csslabX.uwb.edu
where X is a number between 1 and 12.
Again, use your UWNetID and password to log in.
Mac: Open your terminal window. Enter:
    ssh UWNetID@csslabX.uwb.edu
where X is a number 1 to 12. Enter your password to log in.
>>>>>>Now everyone, you're connected to a linux machine at UWB.
Compile and execute with the commands
      g++ -g lab1.cpp intset.cpp
If g++ compiles successfully, a file called a.out is produced.
(The
      ./a.out   (or if using valgrind: valgrind ./a.out)
"./"
says to use the one in this directory.) If you get errors, edit on
your local machine and upload and compile again.
The "-g"
option will give you line numbers on errors when
using valgrind.
If you have a data file, it must be in the directory with your .cpp files.
If your program uses pointers and you would like to see if you have read/write
access errors (trying to access or write to memory that is not yours)
or if you want to see if you have memory leaks, use valgrind:
      valgrind ./a.out
If your program has no pointers, there is no need to use valgrind.
A "Segmentation fault" (segfault) means you crashed on Linux --
a bad memory address, or stack overflow. Valgrind can help you figure it out.
Now, to create the typescript file ...
When you are completely done with lab1, to produce a file of your output,
enter the following. If you mess up, stop (enter Ctrl+d
),
and start over.
You are doing this to capture output in a file, so
do it when you are completely done with lab1.
      script
The
      g++ -g lab1.cpp intset.cpp
      valgrind ./a.out
      Ctrl+d
"script"
command captures everything displayed at the screen
(until Ctrl+d is entered) into a file called typescript
.
(Doing some other things while scripting can cause very weird things to occur,
so don't. Stop by using Ctrl+d, and start again if you mess up.)
The typescript file is the one you will turn in electronically
(so transfer it back to your local machine). It has no file type, no .txt
even though it is a text file.
On the linux machine, you can view the file by using the command "cat" . Enter
      cat typescript
On a Windows machine, you can view it using WordPad or Notepad++.
How to create a datafile on linux machine
Windows and linux store files differently.
While usually transferring data files from windows to linux is fine,
sometimes unintended characters are inserted into the file or the EOF
character is not properly transferred.
If weirdness occurs, create the file on linux, instead of transfering
from windows.
To do this, use the nano editor. Suppose you want datafile data1.txt, enter:
     
nano data1.txt
Copy and paste the data from the website into the file. Backspace so
the cursor is on the last line of data. Then save:
To view it, enter:  
^x // caret means to use Ctrl, so Ctrl-x
y // for "yes" to saving modified buffer
Enter // to save under the file name you gave it
cat data1.txt
If weird stuff happens with the datafile, don't waste time. See me.