C++ On Visual Studio Code



Visual Studio Code (VS Code) is a popular tool for building and editing source code. It can also debug and complies the program. Moreover, VS Code is a free and lightweight tool, integrating many useful extensions in software programming.

Tools required

  • Learn how to configure Visual Studio Code for C development by installing an extension for autocomplete among other things as well as configuring tasks for.
  • Here we've used the following commands to compile and run the code: $ g HelloWorld.cpp -o hellowold $./hellowold Notice that we get the expected Hello World! Running the Script (slightly more advanced) Great, but we can use VS Code directly to build and execute the code as well.
  • Visual Studio Code
  • C/C++ extension from Microsoft
  • Microsoft Visual C++ (MSVC) compiler from Microsoft Visual Studio

Step 1: Install Visual Studio Code

C++ On Visual Studio Code

Open Visual Studio 2019. If the start window is not open, choose File Start Window. On the start window, choose Create a new project. On the Create a new project window, enter or type console in the search box. Next, choose C from the Language list, and then choose Windows from the Platform list. After you apply the language and platform filters, choose the Console App template,. Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows. Download Visual Studio Code to experience a redefined code editor, optimized for building and debugging modern web and cloud applications.

Download and install VS Code from Microsoft at https://code.visualstudio.com/

Step 2: Install the C/C++ extension for VS Code

How To Use C++ On Visual Studio Code

After installing VS Code successfully, open the Extensions tab by pressing Ctrl + Shift + X and search by keyword “C++” as below

Click the install button to install the C/C++ extension from Microsoft.

Step 3: Install the Microsoft Visual C++ (MSVC) compiler

Based on the Microsoft Visual Studio version installed on your computer, install the Microsoft Visual C++ (MSVC) compiler from Visual Studio Installer

Step 4: Check Microsoft Visual C++ (MSVC)

From Start Menu, open Developer Command Prompt

Execute “cl” command, if the result looks like below, you have successfully installed

Step 5: Open Visual Studio Code from Developer Command Prompt

Based on the path to install VS Code on your computer, open the program as follows:

Step 6: Create a Hello World program

At VS Code, press F5 to run the program

If the program outputs the results below, you are successful

Hope to be helpful for you!

Are you using it?

C++ Compiler Visual Studio Code

Visual Studio Code C++ Extension April 2021 Update: CUDA C/C++ IntelliSense and Apple Silicon Support

by Julia Reid

From the article:

The April 2021 update of the Visual Studio Code C++ extension is now available! This latest release offers brand new features—such as IntelliSense for CUDA C/C++ and native language server support for Apple Silicon— along with a bunch of enhancements and bug fixes. To find out more about all the enhancements, check out our release notes on GitHub...