/*******************************************************************
Hello World
1. How to use VLAB
2. How to use Visual Studio Code
3. Frequently asked questions
COMP9024
*******************************************************************/
For desktop and laptop computers we recommend TigerVNC, though any VNC client will work.
- For Mac: download TigerVNC-version.dmg, open the file and drag the TigerVNC app to your Applications folder
- For Windows: download vncviewer64-version.exe to your desktop
- For Ubuntu, run sudo apt-get install tigervnc-viewer tigervnc-common from the terminal
VncViewer |
---|
![]() |
vlab.cse.unsw.edu.au:5920
How to log in |
---|
![]() |
Access the Linux system |
---|
![]() |
1 How to download this project in CSE VLAB
Open a terminal (Applications -> Terminal Emulator)
Terminal |
---|
![]() |
$ git clone https://github.com/sheisc/COMP9024.git
$ cd COMP9024/C/HelloWorld
HelloWorld$
2 How to start Visual Studio Code to browse/edit/debug a project.
HelloWorld$ code
Two configuration files (HelloWorld/.vscode/launch.json and HelloWorld/.vscode/tasks.json) have been preset.
In the window of Visual Studio Code, please click "File" and "Open Folder",
select the folder "COMP9024/C/HelloWorld", then click the "Open" button.
click Terminal -> Run Build Task
![]() |
Open src/main.c, and click to add a breakpoint (say, line 4).
How to add a breakpoint |
---|
![]() |
Then, click Run -> Start Debugging
How to start debugging |
---|
![]() |
![]() |
Debug actions |
---|
![]() |
├── Makefile defining set of tasks to be executed (the input file of the 'make' command)
|
├── README.md introduction to this tutorial
|
├── src containing *.c and *.h
| |
│ └── main.c main()
|
|
└── .vscode containing configuration files for Visual Studio Code
|
├── launch.json specifying which program to debug and with which debugger,
| used when you click "Run -> Start Debugging"
|
└── tasks.json specifying which task to run (e.g., 'make' or 'make clean')
used when you click "Terminal -> Run Build Task" or "Terminal -> Run Task"
Makefile is discussed in COMP9024/C/HowToMake.
HelloWorld$ make
HelloWorld$ ./main
Question |
---|
![]() |
Answer
Click the 'Extensions' icon in VS Code (the icon in the bottom-left corner of the figure below), search for "C/C++ Runner", and install it.
![]() |
Only one main() function definition is allowed in the src directory of each project.
4.3 Open one project (e.g., COMP9024/Sorting/BubbleSort) in VS Code, rather than the root directory (i.e., COMP9024)
The directory structure of a project in COMP9024
BubbleSort
├── diagrams
├── images
├── Makefile
├── README.md
└── src
To be simple, the Makefile used in COMP9024 does not support whitespace characters (e.g., "Bubble Sort") in the directory name.
$ git clone https://github.com/sheisc/COMP9024.git
fatal: destination path 'COMP9024' already exists and is not an empty directory.
Answer
Rename the directory COMP9024 to a non-existing name (say, MyCOMP9024)
$ mv COMP9024 MyCOMP9024
$ git clone https://github.com/sheisc/COMP9024.git
For privacy and security reasons, the teaching team will NOT help with this.
When you are ready, you can do it by yourself.
CSE VLAB can make things easier for us.
We will use Visual Studio Code, make and gcc in CSE VLAB.