Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame
C++ developers tend to be partial to their editors and might consider Visual Studio Code (VSCode) as a lightweight tool not worthy of their attention. Having said that, they could be wrong! More importantly, people looking to learn C or C++ from ground zero might find many editors to be so overloaded with features that it distracts from learning the core language. Although a full-blown version of Visual Studio, such as Visual Studio Community Edition, can be great tool for doing C and C++ coding, there are many times when it can be overkill. With the addition of the C/C++ extension to Visual Studio Code, you might have what is needed in a small, cross-platform editor.
The extension includes support for code formatting, auto-completion, debugging, and a lot more. You can get many of the details either from the marketplace or from the Microsoft C/C++ extension for VSCode documentation page.
Figure 1 presents what is seen at this URL. As you can see in the figure, a simple click of Install should start the installation of the C/C++ extension.
Figure 1: The Marketplace listing for the C++ Extension
The install process likely will open your copy of Visual Studio Code, as shown in Figure 2. You might then need to click another Install button, also shown in Figure 2.
Figure 2: Installing the C++ Extension in Visual Studio Code
Once you've added this extension, you'll be able to enter C/C++ programs in VSCode. You'll also see that the editor supports many of the features mentioned earlier. Figure 3 shows the Visual Studio Code with a code listing included.
Figure 3: Colored C++ Code in VS Code
Other C++ Extensions for VSCode
In addition to the basic C/C++ coding extension for Visual Studio Code, there are several other C++ extensions that can be used with the editor. These include:
- C/C++ Clang Command Adapter: Includes completion and diagnostic for C, C++, and Objective-C using Clang Commands
- C/C++ Snips: Support for C/C++ code snippets
- C++ IntelliSense: IntelliSense with the help of GNU Global tags for C/C++
- C++ Algorithm Mnemonics: C++ Algorithm Mnemonics as code snippets for VSCode
- C++ Advanced Lint: Analysis extensions for C/C++ that support a number of back-end analyzing programs
- CrossBuild: A build system for embedded development
You can find extensions that can be added by clicking the extension's icon on the left and then entering C++ in the search box. This will list the extensions, similar to what is shown in Figure 4.
Figure 4: C++-related extensions for Visual Studio Code
Clicking the extension name will present additional information on the right side of the editor window. The description also should include a link to install, reload, or disable the extension.
Compiling C++ in Visual Studio Code
Even though Microsoft offers Visual Studio Community at no cost, there are times when that is overkill or more than is needed. Visual Studio Code offers an open source, cross-platform editor that has a relatively small footprint. With the addition of extensions, VSCode is a great tool for quickly accessing and editing C++ code, whether you are a beginner or an advanced developer. With the addition of an open source compiler that is native to your platform, you can use VSCode as a complete tool for building your C++ solutions.