Introduction
The C/C++ extension by Microsoft brings full-featured IntelliSense, debugging, and code navigation to Visual Studio Code. It transforms VS Code into a capable C and C++ IDE with support for GCC, Clang, and MSVC toolchains across Linux, macOS, and Windows.
What the C/C++ Extension Does
- Provide context-aware code completion and parameter hints for C/C++
- Enable breakpoint debugging with GDB, LLDB, and the Visual Studio debugger
- Navigate code with Go to Definition, Find All References, and Call Hierarchy
- Display inline diagnostics and compiler errors as you type
- Support CMake, Makefile, and compile_commands.json project configurations
Architecture Overview
The extension runs a language server process that parses your C/C++ source files and headers using a custom IntelliSense engine. It reads compilation databases or user-configured include paths to resolve symbols accurately. For debugging, it communicates with GDB or LLDB through the Debug Adapter Protocol, providing a graphical debug experience in the VS Code UI.
Self-Hosting & Configuration
- Install from the VS Code marketplace; works on Linux, macOS, and Windows
- Configure include paths and compiler settings in
c_cpp_properties.json - Point to a
compile_commands.jsonfor accurate project-wide IntelliSense - Set up launch configurations in
launch.jsonfor debugging - Pair with the CMake Tools extension for seamless CMake project integration
Key Features
- IntelliSense engine provides accurate completions even in large codebases
- Integrated debugging supports conditional breakpoints, watch expressions, and memory inspection
- Code formatting with clang-format integration and configurable styles
- Header/source switching with a single keyboard shortcut
- Remote development support via SSH, containers, and WSL
Comparison with Similar Tools
- CLion — full C++ IDE by JetBrains; VS Code C/C++ is free and lighter weight
- clangd — alternative language server; the Microsoft extension offers tighter VS Code integration
- Eclipse CDT — Java-based IDE; VS Code provides a faster, more modern editing experience
- Code::Blocks — standalone C++ IDE; VS Code offers a larger extension ecosystem
FAQ
Q: Which compilers are supported? A: GCC, Clang, and MSVC on their respective platforms. The extension auto-detects installed compilers.
Q: Can I use it with CMake projects? A: Yes. Install the CMake Tools extension alongside it for full CMake integration including build, test, and debug.
Q: How do I fix IntelliSense errors?
A: Ensure your include paths are correctly configured in c_cpp_properties.json or provide a compile_commands.json file.
Q: Does it support C++20 and C++23 features?
A: Yes. Set the cppStandard property in your configuration to enable modern C++ standard support.