How to Fix VS Code Not Showing C++ Errors

Visual Studio Code (VS Code) provides a great platform for writing, debugging, and managing code projects. However, there are instances where VS Code might not show errors for C++ code. This can be frustrating as it limits workflow development and can be challenging to track and fix errors quickly.

How to Fix VS Code Not Showing C++ Errors

Read on to understand why VS Code may fail to show C++ code errors and how to diagnose and correct them.

Why VS Code May Fail to Show Errors in C++

VS Code supports debugging but is not bundled with the C++ debugger. As such, users have to add one. Normally, VS Code will prompt users to add a C/C++ debugger when initiating a fresh project. If the prompt doesn’t appear or is missed, access it from the left toolbar by extensions. You can then search for the “C/C++” extension. Note that it may be necessary to reload the project to enable it.

Understanding why the VS Code fails to show errors helps implement lasting solutions and ensure the code functions correctly. If you are using Visual Studio Code to develop C++ and errors aren’t showing, there are a couple of reasons and solutions to consider.

Enable Error Squiggles

One of the reasons why the VS Code may fail to show errors in C++ is that Error Squiggles aren’t enabled. You can enable it locally in your workspace.

  1. Press Ctrl, Shift, and P in Linux and Windows. (Or Command, Shift, and P on macOS)
  2. The Command Palette can also be opened by pressing F1.
  3. In the search field, type the words Error squiggles.
  4. Go to the C_Cpp: Error Squiggles setting and ensure it is enabled.
    Setting C_Cpp.errorSquiggles to enabled in VS Code Settings.json

After following these steps, you should see the error squiggles. To disable them, go to the above setting and set it to disabled.

Squiggles are wavy lines under your C++ code within the editor, and they’re indicators or warnings for errors and issues in the code. They do code analysis to check for unused imports, undefined variables, and all sorts of problems that could affect the readability and functionality of code.

The Squiggles’ style and color can vary depending on the type of issue and its severity. Red squiggles show critical problems, while the yellow and blue squiggles represent warnings and suggestions. Paying attention to these lines helps identify issues and improve the correctness of code. Suggestions are often provided by hovering or clicking on them.

Compiler Path Configuration

You must configure the path to the C++ compiler in VS Code correctly. For this, use the C_Cpp.default.compilerPath option within the VS Code settings. The compiler path should be correct and lead to the right executable. This way, the editor knows precisely where it needs to be used during error checking. To configure, you need to do the following:

  1. Go to the project or workspace in VS studio whose compiler path you need to configure.
    Selecting a project in VS Code
  2. On the workspace, navigate to File, then Preferences. From here, open the Settings menu. An alternative is to use the Ctrl+comma(,) VS Code keyboard shortcut.
    Selecting Settings from the Preferences menu in the File Dropdown in VS Code
  3. Under settings, look for the C_Cpp.default.compilerPath option and select Edit in settings.json.
    This way, you can modify the setting for your workspace specifically.
    Clicking the Edit in settings.json in the VS Code Settings menu
  4. In the settings.json file, add this line to specify the path: “C_Cpp.default.compilerPath”: “path/to/your/compiler”
    Highlighting the path to the compiler in VS Code settings.json
  5. You now need to replace “path/to/your/compiler” using the C++ compiler executable actual path.
    Changing the path to the C_Cpp compiler in VS Code settings.json
  6. Save the file by pressing Ctrl+S to apply the changes.

After successfully configuring the path, you can see whether VS Code checks errors as it should. This compiler path is used for checking diagnostics and errors, and to build code.

For multiple C++ projects, you must repeat the above steps for each one. Alternatively, configure the path globally through the user settings. Do this by modifying the settings.json file at the user level instead.

Build Task Configuration

It’s important to check that the Build Task configuration is defined correctly within the VS Code workspace. Do so by opening the .vscode/tasks.json file. This helps verify Build Task is configured correctly, including the source file and compiler.

  1. Go to the project or workspace that needs Build Task configuration.
    Selecting a project in VS Code
  2. In the project, create your .vscode folder if it is not available already. This file will hold specific configuration files.
    Highlighting the VS CODE folder in VS Code
  3. Create a tasks.json file within the folder, with the build task configuration.
    Opening tasks.json in VS Code
  4. Define the build tasks by opening the tasks.json file.
    Defining tasks in tasks.json in VS Code
  5. You must adjust the command and args fields according to specific build and compiler requirements.
    Saving the tasks.json file in VS Code
  6. Save your tasks.json file to apply all the changes made.

The build task configurations may be customized further by adding some tasks or modifying the existing tasks to suit your needs.


VS Code relies on Intellisense configurations to offer error-checking and code suggestion solutions. It’s important to have the right C++ extensions installed. These are ms-vscode.cpptools and twxs.cmake. These should be updated for proper functioning.

You should check the C_Cpp.default.intellisenseMode configuration mode, and set it to either “clang-x64” or “gcc-x64” depending on the compiler.

Intellisense keeps improving. It can be customized as well. If the VS Code isn’t detecting errors, you should try fine-tuning it by adjusting some settings here. When intellisense in VS Code is leveraged, you can enhance the entire user experience, putting you in a better position to find errors in the code.

Paths and Compiler Flags

If the C++ includes directories, it depends on some external libraries. This has to be specified correctly. You must include the compiler flags and paths in the workspace configuration or the CMakeLists.txt file.

Look for Any Extension Conflicts

It’s important to disable any other extensions interfering with the development of C++ in VS Code. Some extensions like formatters or linters conflict with IntelliSense or error checking.

Cleaning and Rebuilding

If you made any changes to the build configuration or the code, you must try cleaning the artifacts and rebuilding the project. This way, you can ensure that no previous errors linger.

Verify the Code Syntax

Take time to check the code for any syntax errors or even missing semicolons that could hinder the proper detection of errors. A simple error can often mess up the whole error-checking process.

Restart Visual Studio Code

If you try everything but nothing works, consider restarting VS Code. The Integrated Development Environment (IDE) could encounter glitches, which may require a fresh start to resolve. Checking all the potential causes helps you troubleshoot the issue. This way, error checking is restored for the C++ projects. You can also try uninstalling and re-installing the extension. Sometimes, it’s all that’s needed to resolve the matter.

Resolve the VS Code Not Showing Errors C++ Issue

Resolving the VS Code not showing errors in the C++ issue is the only way to boost efficient code development and make sure it’s accurate. By troubleshooting, developers are in a position to overcome the challenge and streamline the whole process. Error-free coding enhances the potential for every project.


I have installed the C++ extension, but errors are still not showing up. What could be the problem?

Ensure your code is saved with the correct file extension (.cpp), and try reopening VS Code. Sometimes, restarting the editor can resolve such issues.

How can I check if the C++ extension is installed in VS Code?

You can check by going to the Extensions view (Ctrl+Shift+X) and searching for “C++”. If the extension is not installed, you can install it from there.

Disclaimer: Some pages on this site may include an affiliate link. This does not effect our editorial in any way.

Todays Highlights
How to See Google Search History
how to download photos from google photos