This was made in order to help students with the installation oF WSL, g++, and the work arounds using Visual Studio Code from Rincon's 2022 Fundamentals of Operating Systems class. If there is an update you'd like to add, please create a pull request with the changes.
- Troubleshooting is at the end for simple issues that may arrise!
Prereqs:
- Make sure you have Virtualization enabled on your machine! Typically Windows 10+ has it enabled but you can use these steps to check!
Instructions/Guide:
- Open Powershell/CMD with admin perms.
- Download WSl with
wsl --install
. This will require a system reboot. - Open your windows tart menu and type ,
Ubuntu
, if nothing pops up, then you're going to have to download it from the Window's Store. - Once your Window's store is open, type "Ubuntu" with the search tab and download the app from it.
- This will download and then depending on your computer, its either going to autocomplete it or you're going to create a profile. It's fairly simple, set your username and password to your liking and just continue basically.
- Once finished, the Ubuntu terminal should now open, if not, just go to your start menu and type
Ubuntu
and run the app. - First thing, do the follwing command
sudo apt update && sudo apt upgrade
within your Ubuntu terminal. Just typey
if the terminal is asking to reserve/use space within your disk. - Once it's done downloading, run the following command
sudo apt-get install build-essential gdb
. Typey
if it ask you to. (This is your C++ Compiler being installed.) - Once it's done downloading, run the following command
mkdir RinconOperatingSystems
(This is going to create a folder in the root of your WSL. This is essentially where your homework and such is going to be stored.) - Go within that folder you just created by doing the command
cd RinconOperatingSystems/
- Run the command
code .
(This is going to more likely download and/or open Visual Studio Code within your WSL) - First thing, download the necessary extentions. Go to the extentions tab found on the left side of your screen (looks like four boxes) and download the following items.
- C/C++ By: Microsoft
- C/C++ Extension Pack By: Microsoft
- Remote - WSL By: Microsoft [You may also only see "WSL", which is the same thing.] This will require a VSCode restart
- Create a basic
main.cpp
file that prints Hello World to console. - On the left side of the screen, click on area that looks like a play button. Click on
Create a launch.json
on the left panel area. This should automatically create a basic launch.json within the folder called,.vscode
. - Go to the folder that Rincon provided in Blackboard for
VS Code File - WIN - WSL
- Once extracted, then you're going to want to grab three files (keybinding, task, & launch) from the
WinFiles
, and drag and drop them within your.vscode
folder that was automatically created when you did step 14. Replace all of the files. - You can try doing
CTRL + r
, to see if your keybindings are working. If not, you can also do f5 or going to the play button again, and clicking on the green play button you see near the top left of your screen. - You should then see a bunch of debugging ouput within your
Debug Console
tab and also see an output of 'Hello World' in yourTerminal
tab. If you see these, you are now complete!
Troubleshooting
"How do I go back to my WSL workplace once I closed it?"
- There is three main ways you can go about this.
- Open VSCode and see if VSCode will restore your previous workplace.
- Open VSCode and click on
file
on the top left, clickOpen Recent
and find it through there. You're probably looking something as~/OperatingSystems/ [WSL: Ubuntu]
. - Close your Ubuntu terminal, reopen it, and follow steps 10 & 11.
"My key bindings that Rincon provided isn't working!"
- The way I fixed this was by setting the global keybinds, since VSCode does not provide workplace specific custom keybinds.
- Open VSCode WSL workplace and click
CTRL+SHIFT+p
, typeOpen Keyboard Shortcuts
, and click onPreferences: Open Keyboard Shortcuts (JSON)
. This is going to open akeybindings.json
file. - Go back to the
keybindings.json
that Rincon provided and copy & paste it within thekeybindings.json
file that VSCode opened. Make sure there is no errors, you are rewritting the entire file. - Save it and close the files. Click
CTRL+r
and it should be working normal now.
- Open VSCode WSL workplace and click
"My main.cpp ins't running!"
- Your main possible issue is that you created a main.cpp file within your
.vscode
folder. Just drag it outside that folder and attempt to run it again. This should fix that issue.
"I can't drag and drop the files from Rincon"
- Make sure that you have extracted the file from the zipped folder. Its going to create a new folder and/or simply open a new window. Either open the new folder or use the new window- This will now allow you to drag and drop the files from the unzipped folder.
"Which files am I moving to VSCode from Rincon's?"
- The WinFiles. The path shoould kind of look like...
|- WinFiles
|---_MACOSX
|------(Files we dont need)
|---WinFiles
|------.DS_Store
|------keybindings.json
|------launch.json
|------tasks.json
Within the WinFiles>WinFiles>..., You're going to then drag and drop the keybindings.json, launch.json, and task.json
"I am stuck on step 14, clicking on the play button will not tell me to create a launch.json"
- That's fine, what you're going to do is create a folder. It should by the symbol right next to the create file. You're going to name the folder
.vscode
. You may now continue to the following steps.
"The command I'm doing is not working inside the terminal!
- A common error is a user error, which typically is a simple typo. Make sure you are typing the commands correctly!"
"What do I do with the files Rincon provided?"
- Please follow steps, 15-18. If you're continuing to have trouble, please look at #4, #5, #6, and #7 in troubleshooting.
"VSCode didn't make a .vscode folder, what do I do?"
- Follow Troubleshooting #6
"I'm getting a Nonexistent File error. Something dealing with a .vscode-server folder?"
- A student has found that simply deleting and reinstalling VSCode fixed this issue.