Quick Reference - Using Visual Studio Code


Using VSCode

Quick jump: Create a project/Open existing project | Add a new file | Add an existing file | Finding your text file output/input | Finding your source files | Building your code | Running your program

Create a project/Open existing project

VSCode doesn't have a concept of "projects" (afaik). Instead, you will Open a Folder in VSCode, and have your source code file(s) inside that folder.

 

Navigate to within a folder where you will store your code (or a directory that already has code) and click OK.

 

The code files will show up in the Explorer bar.

 

Add a new file

Go to the File drop-down menu and select the New file.

Save the file in your project folder. C++ source files must end with .cpp, .h, or .hpp.

Add an existing file

Move the source file into the folder for your project. Then, go to the File dropdown menu and select Open file. Select your file and hit OK.

Finding your text file output/input

Output text files should be generated in the same path as your source files. If making an input text file, put it in the same directory as your source files.

Finding your source files

Your source files should be in the folder that you opened in VSCode.

Building your code

Click on the Run dropdown menu and select Start Debugging.

 

Select C++ (GDB/LLDB).

 

Then select g++ as the compiler.

 

Your program output will show up under the Terminal tab at the bottom.

 

If there's a build error, click Show Errors. Error messages will show up under Problems.



 

Running your program

In Windows and Linux, after you build your program it shoudl show up in the Terminal pane at the bottom of the screen.

 

In Mac, you will need to locate your project directory in Finder or in your system Terminal and run the program from there.