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
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:
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++":
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:
If you now deliberately add an error, you will notice the Intellisense correctly catches the error:
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":
Then, you will notice asettings.json
file is generated inside the .vscode
folder with the updated setting:
Now, everything is good to go, with only the real errors correctly catched by Intellisense:
Resource
Just experimented with various config/setting tweaks in VS Code.