Skip to Content

Visual Studio Code Help

Visual Studio Code (VSCode) is not Visual Studio, but rather a separate code-centric editor and cross-platform mini-IDE. It’s actually a pretty nice development environment, though it can be a bit complex to customize to your liking.

VSCode is already available on the CS Departmental computers. VSCode is available at: (along with lots of documentation and help), and I would recommend installing it on any other computers you use.

On Linux, it installs as the command-line command code. You will usually want to run it in the background, so code & is a better command. It is also available in the applications toolbar, just search on “code”.


VSCode has many many extensions available that enhance its capabilities. The version numbers are the latest as of 18 Jan 2023; you should grab whatever is the latest. Below are some recommendations

  1. C/C++ v1.13.9 from Microsoft – you really want this one, it includes the basic support for programming C/C++ in VSCode. Many other languages are supported, too.

  2. Remote - SSH v0.94.0 from Microsoft (installs three extensions) – this one will let you edit code in a project that is not on your local computer that you are sitting at; this means you could work in your CS-machine-hosted workspace while sitting at home. This can be useful, but I also recommend that you learn how to develop code on your own computer(s).

  3. Makefile Tools v0.6.0 from Microsoft – this one allows you to use make from within VSCode to build and test your programs. We will use make in this course!

  4. (maybe) GitHub Classroom v0.0.3 from GitHub (might be worse than what it helps) – this extension automates some of the GitHub assignment management; I have not tried it yet, and I would rather that you just learn how to use Git and GitHub directly, because these are good skills to have.


Settings has many customization points.

Once you have the C/C++ Extension installed, Settings->Extensions->C/C++->Formatting enables you to customize the auto-formatting of your code. There are several basic styles, you can search the web for more info. For me, what I did was leave the default “Visual Studio” style, and then changed the following:

  1. Unchecked both New Line : Before Catch and New Line : Before Else

  2. Set New Line Before Open Brace : Block to “same line”

  3. Set New Line Before Open Brace : Function to “new line”

  4. Set New Line Before Open Brace : Type to “new line”

Setting up Debugging

On Linux, you need to set up the ability to debug your C/C++ program inside VSCode.

  1. From the Run menu, select Add Configuration

  2. The editor pane will switch to a “launch.json” file edit, with a big blue button “Add Configuration”. Click this button.

  3. From the list that pops up, select “C/C++: (gdb) Launch”.

  4. The launch.json file in the editor pane will now contain a JSON specification for this.

  5. In the JSON spec, change the property “StopAtEntry” from false to true.

  6. In the JSON spec, change the property “program” from its default of “enter program name, for example ${workspaceFolder}/a.out” to “${workspaceFolder}/program” – where “program” is the name of the executable that your program compiles into. This is likely the root name of your source file that contains the main() function. If this is “hello.cpp”, then your program name is “hello”.

You need to do this in each C/C++ project your develop. There are probably some global definitions you can create, but I am not that much of an expert yet to know them.

Creating a Run Task

You can create a VSCode task to run your program. You have to add a task to tasks.json. If you select “Configure Tasks” from the “Terminal” menu, the editor will pop up a pane with tasks.json in it. A typical run task looks like:

    "type": "process",
    "label": "JEC: Run my program example",
    "command": "${workspaceFolder}/hello",
    "args": [
    "options": {
      "cwd": "${workspaceFolder}"
    "group": {
      "kind": "test",
      "isDefault": false
     "detail": "Example task written by Jonathan Cook"

You can edit the example as need, specifically changing the program name, changing the command line arguments, etc. The type and kind are important to keep as is.