Nearby lessons
10 of 124C - 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:
| Feature | What you get |
|---|---|
| IntelliSense | Autocomplete for functions, variables and struct members |
| Error squiggles | Red underlines on mistakes before you compile |
| Go to definition | F12 jumps to where a function is defined |
| Hover info | Function signatures and types on mouse-over |
| Formatting | Shift + Alt + F tidies indentation automatically |
| Debugging | Breakpoints, 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
- Open VS Code.
- Press Ctrl + Shift + X to open the Extensions panel.
- Type C/C++ in the search box.
- 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
Confirm It Is Working
Create a file called test.c, type the code below, and watch what happens as you type:
Example04
Signs the Extension Is Active
- Keywords such as
intandreturnappear in colour. - Typing
pripops up a suggestion list containingprintf. - 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
| Extension | Why you might want it |
|---|---|
| Code Runner | Compile and run with Ctrl + Alt + N, no config needed |
| C/C++ Themes | Colour schemes tuned for C syntax |
| Error Lens | Shows the error text inline instead of only on hover |
| Better Comments | Colour-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 QuestionsProgress: 0 / 3