How to install and Configure WSL, VSCode, and a compiler on Windows 11
Windows users will need to set up a Unix-like environment on their own machine.
We have recorded a video to walk you through setting up this environment, along with VSCode and a compiler on your own computer.
Currently the simplest way of doing this is by using WSL (Windows Subsystem for Linux) which installs another operating system, Ubuntu into a virtual machine.
Then, you can install the compiler (clang) and your code editor (Visual Studio Code).
Written Instructions
We can also point you to more exhaustive written instructions for each step of the way. If you run into issues doing this, please create a thread on Ed.
-
To install WSL follow https://learn.microsoft.com/en-us/windows/wsl/install
-
Starting from the “Set up and best practices” step, follow the page below straight till the “Use Visual Studio Code” step: https://learn.microsoft.com/en-us/windows/wsl/setup/environment This should get your WSL and VS Code set up.
-
In VS Code Marketplace, search for C/C++ extension pack and install it, and you are set.
-
VS Code won’t support clicking the run button to compile and run your C program. Instead, use the Terminal menu to start a terminal to run the clang command to compile and run your code. If you get an error message about unable to recognize clang gcc command. Use the following command in Terminal to install clang or gcc respectively:
The code you write in VS Code under Ubuntu will be located under \\wsl$\home\[your username]\
(put this in your Explorer under Windows to get to the folder).