This guide documents the steps to perform in order to install, on windows-based laptops and desktops, all the software needed to fruitfully attend the hands-on session of this C++ Basic Workshop.
To enable the most recent version of Windows Subsystem for Linux, Virtualization
must be enabled on your device. You can check if Virtualization is enable by
opening the Task Manager (Ctrl+Shift+Esc
) in the Performance tab.
If Virtualization is disabled, you should be able to enable it from the BIOS. The procedure varies based on you PC manufacturer; check this article for an example.
The setup of WSL depends on the version of the OS installed:
Open PowerShell in administrator mode and enter the following command:
wsl --install
then restart your machine.
The above command only works if WSL is not installed at all, if you run WSL --install
and see the WSL help text, run
wsl --install -d Ubuntu
to install the latest Ubuntu distribution.
The manual installation requires a few more steps. You can follow the guide here
Once you have installed WSL, you need to create a user account and password for your newly installed Linux distribution.
You can start WSL by running the WSL
command from any terminal, or look for Ubuntu in the start menu.
When launching WSL
from terminal make sure to navigate back to the home
directory of Linux (run the command cd
with no arguments), to avoid working in
a mounted folder on Windows.
For the course we suggest using VSCode as IDE and text editor.
Download and install it on Windows from the VSCode website, making sure to select the "Add to PATH" option during the installation.
Download and install the Remote Development Extension.
We also suggest to install the C/C++ Extension Pack
With the Remote Development Extension you can now run the code
command from WSL to open VSCode (you may need to restart WSL the first time).
From the bash command line in WSL, run the following commands to setup the workspace:
sudo apt update && sudo apt upgrade
sudo apt install g++ git clang-format cmake libsfml-dev
To use graphical user interfaces in Linux, you need to setup an X Server. In Windows build version 21364 or higher, WSL supports a GUI natively.
In WSL run the following commands:
sudo apt install x11-apps
xclock
If no error occurs, no further action is needed.
Otherwise, try first updating your WSL version, by running from PowerShell:
wsl --update
If this doesn't help, you have to install an external X Server, following this guide.