SFU Lab for Programming C++ (CSIL Linux)
SFU Computing Science provides a number of computer labs (CSIL) on both Surrey (SRYE 3024, SRYE 4013, SRYE 4013) and Burnaby campuses. These machines have everything installed and ready to go!
This video shows the process of running VS Code in lab.
The steps below guide you through getting VS Code up and running in the lab.
Log Into Linux
- Make sure the lab computer is booted in Linux.
- If it's in Windows, tell it to restart.
- As it restarts you'll be able to select booting to Linux from a text menu..
- Log in using your SFU computing ID and password.
Launch VS Code and Install Extensions
- Click "Activities" in the top left corner of the screen.
- Type in "Code", and click on the icon for "Visual Studios Code".
- Install C/C++ extensions (do once):
- On the left activity bar, select Extensions
- Search for "C/C++ Extension Pack"
- Select "Install"
- Create
cmpt130
folder on the CSIL server for your course work (do once):- We will create a folder on the SFU server to store your code. All your code will be securely stored on the SFU server, so you can connect from any computer to access your files.
- In VS Code via the VDI, open a terminal by going to the menu at the top (you may need to click the "..."):
Terminal > New Terminal - Change to the folder that is your SFU provided space to save your files:
cd ~/sfuhome
- This folder will be available to you on all SFU computers (CSIL labs, CSIL via SSH or VDI, and all SFU computer labs).
- Other locations under the "~" folder (which is called the "home" folder) are on the CSIL server and would be available only when connected to any CSIL machine.
- Using
~/sfuhome
makes it available on all SFU lab computers (not just CS labs).
- Make sure that the SFU home folder has correctly "mounted" (become available to use):
ls
If you see@_This_IS_NOT_your_real_sfuhome_README.txt
, then see troubleshooting below. - Create a folder for CMPT 130:
mkdir cmpt130
Note: No spaces, suggest keeping all the characters lower-case (but you can pick).
- Open the
cmpt130
folder:- In VS Code, from the menu at the top, select: File > Open Folder...
- In the window select
sfuhome
, and thencmpt130
. - Click Open (top right).
- If asked "Do you trust the authors of the files in this folder?", select "Yes, I trust the authors".
Write Your Program
- Create folder for your work (lab/assignment/...):
- In the Explorer pane on the left, select the "Create Folder" button at the top.
- Name the folder based on what you are working on, such as
lab1
, orlecture_week_2
- Creating folders for your work helps organize all your files; don't put spaces in the filename
- Open/Create file:
- Right-click on your
lab1
folder (or whatever name you gave it) and select "New File" - Name the file as needed, such as
main.cpp
. - Click on the file you created to open it.
- Right-click on your
- Code, Build, Debug:
- Write your C++ code in the file
- Run your C++ code by either:
- Above your code, click the Debug C/C++ File button
(Or, click the drop-down beside it and select to Run C/C++ File)
If prompted to "Select a debug configuration", choose "C/C++: g++ build and debug active file...". If given multiple options, pick the first one listing "g++" (not "gcc"!) - Via the menu at the top select: Run > Start Debugging (or Run Without Debugger)
- Press F5 (or whatever hotkey File > Start Debugging lists)
- Above your code, click the Debug C/C++ File button
- When done, log out.
- Once you are finished for the day, log out of the computer (it's a shared resource!)
- Click the power icon in the top right of the Linux desktop and select Log Out.
Submitting Code from SFU CSIL Lab
When developing using the SFU CSIL computers with your cmpt130
folder under your sfuhome
folder, it means all your files are stored on SFU's central file server. This server is backed up and secure!
To submit your code, you can go to any SFU computer and use the web browser to browse to your sfuhome/cmpt130/
folder and submit your code.
Troubleshooting
- If your
~/sfuhome
folder does not have your files and only has@_This_IS_NOT_your_real_sfuhome_README.txt
:- If you see this file then it means that the real SFU home folder is not available! Don't use this folder until you resolve the issue, otherwise your files will not be saved.
- On the SFU network, your home folder exists on a file server. The CSIL system "mounts" that folder into
~/sfuhome
. For some reason, the CSIL server was not able to mount your folder correctly. - Try:
- Close your VS Code, open it again and reconnect.
- Connect to a different CSIL server (choose a different server number: 01 to 10).
- Read the file for some things to try:
cat @_This_IS_NOT_your_real_sfuhome_README.txt
- Reach out to CS Helpdesk. Let them know your SFU Computing ID, the server you are trying to access, and that you are seeing the
@_This_IS_NOT_your_real_sfuhome_README.txt
file.
- If unable to log into a CSIL machine (rejected password, ...):
- Check your user ID and retry your password.
- Check your ID is correct; for example mine is bfraser
- Ensure your user ID and password work with SFU by logging into coursys.sfu.ca
- Try another computer; ask the TA; post a question to Discord.
- Submit a help ticket by emailing helpdesk@cs.sfu.ca. Include:
Course: CMPT 130 with Dr. Fraser
Computer ID: {fill in the name of the computer you are trying to connect to}
Explain what you are trying to do, and what happened.
- Check your user ID and retry your password.
- If you cannot find VS Code on the machine, or your program is unable to find the compiler then ensure that you have booted the computer into Linux. See the video for what it looks like.