A One-Liner Fix to Remove Annoying Red Error Squiggles

How to Fix VS Code Intellisense Error Squiggles for Unreal Engine Projects

A single-line solution to get rid of all false Intellisense red error squiggles in Visual Studio Code C++ code for your UE projects

Peter D Lee, CFA

--

Banner image created by Peter D Lee

The Problem

When you use VS Code to work on your Unreal Engine projects, you probably noticed all those false red error squiggles for C++source and header files:

False Red Error Squiggles in VS Code Intellisense for UE Projects

The Fix

The only thing you have to do to fix this is: add an explicit “compilerPath” config.

Add "compilerPath":"/path/to/your/system/compiler" to the configurations in c_cpp_properties.json inside the .vscode folder. In macOS, you can use "/usr/bin/clang" or "/usr/bin/clang++":

Add compilerPath to configs in c_cpp_properties.json

Note: you will have two separate .vscode folders, one for your project and one for the Unreal Engine (the two workspace roots you will have from generating a VS Code project from Unreal Engine). Add "compilerPath" to the c_cpp_properties.json files in both.

Then, you will notice all of the false red squiggles are now gone:

Fixed after adding compilerPath to configs

If you now deliberately add an error, you will notice the Intellisense correctly catches the error:

Intellisense now correctly catches only real errors

Bonus

In the above screenshot, you might have noticed a mismatch in the number of errors displayed by the file name (“2"), and number of red squiggles (“1”) shown in the code.

Also, if you look at the header file, you will see red squiggle for #pragma once .

If you hover over these errors, you will see the following error message:

#include errors detected. Consider updating your compile_commands.json or includePath. Squiggles are disabled for this translation unit...

To fix this, you can change the C_Cpp.errorSquiggles setting to "Enabled" in settings.json inside the .vscode folder.

You can do this by clicking the yellow bulb icon next the the error squiggle and selecting “Enable all error squiggles”. The default setting for this is "EnabledIfIncludesResolve":

Updating C_Cpp.errorSquiggles setting to “Enabled”

Then, you will notice asettings.json file is generated inside the .vscode folder with the updated setting:

settings.json generated with the updated workspace setting

Now, everything is good to go, with only the real errors correctly catched by Intellisense:

Everything good.

Resource

Just experimented with various config/setting tweaks in VS Code.

--

--