Nearby lessons

10 of 124

C - Install C/C++ Extension

Install the Microsoft C/C++ extension in VS Code to get IntelliSense, error squiggles, code formatting and debugging support for your C programs.

What the Extension Adds

Out of the box, VS Code treats a .c file as plain text. The C/C++ extension teaches it the language:

FeatureWhat you get
IntelliSenseAutocomplete for functions, variables and struct members
Error squigglesRed underlines on mistakes before you compile
Go to definitionF12 jumps to where a function is defined
Hover infoFunction signatures and types on mouse-over
FormattingShift + Alt + F tidies indentation automatically
DebuggingBreakpoints, step-through and variable inspection via GDB
The extension does not compile your code. It calls the GCC you installed in the previous lesson. If GCC is missing, the extension cannot help you.

Install It in Four Clicks

  1. Open VS Code.
  2. Press Ctrl + Shift + X to open the Extensions panel.
  3. Type C/C++ in the search box.
  4. Pick the entry named C/C++ published by Microsoft and click Install.
In simple words: check the publisher. Several look-alike extensions exist; the correct one says "Microsoft" and has tens of millions of installs.

Install from the Terminal Instead

If you prefer the command line — or want to script your setup — install by extension id:

Example03
CCode Cell
1code --install-extension ms-vscode.cpptools
2 
3# optional extras
4code --install-extension formulahendry.code-runner
5code --install-extension ms-vscode.cpptools-themes
Output
Installing extensions...
Extension 'ms-vscode.cpptools' v1.23.6 was successfully installed.

Confirm It Is Working

Create a file called test.c, type the code below, and watch what happens as you type:

Example04
CCode Cell
1#include <stdio.h>
2 
3int main()
4{
5 printf("Extension check\n");
6 return 0;
7}
Output
Extension check

Signs the Extension Is Active

  • Keywords such as int and return appear in colour.
  • Typing pri pops up a suggestion list containing printf.
  • Deleting the semicolon draws a red squiggle immediately.
  • The bottom-right status bar shows C as the language mode.
Trainer's Note: If suggestions do not appear, open the Command Palette (Ctrl + Shift + P) and run C/C++: Log Diagnostics. It reports exactly which compiler the extension found, which usually reveals the problem in one line.

Optional Companions

ExtensionWhy you might want it
Code RunnerCompile and run with Ctrl + Alt + N, no config needed
C/C++ ThemesColour schemes tuned for C syntax
Error LensShows the error text inline instead of only on hover
Better CommentsColour-codes TODO and warning comments
📝 Key Takeaways
  • The extension is "C/C++" by Microsoft, id ms-vscode.cpptools.
  • It provides IntelliSense, go-to-definition and debugging — not compiling.
  • Install it from the Extensions panel (Ctrl + Shift + X).
  • Code Runner is a useful optional extra for one-click runs.

🧠 Test Your Knowledge

3 Questions
Progress: 0 / 3