Windows users:
There's a problem using older versions of of Unreal (such as 5.4) with newer versions of C++ libraries. Info
and fix
are available here
- Updates
- Important info
- Info
- Recommends Extensions
- Quick Start Guide
- Documentation
- Upgrading Older Projects
- Mac Support
- Troubleshooting
- (Bug) Older Unreal versions with newer C++ libraries (Windows only)
- Create BuildConfiguration.xml
New info Mar 15, 2025
This page has been updated. New sections and updated info.
New info Feb 12, 2025
Windows: Should use LLVM (clang-cl/clangd) 18.1.3-18.1.8 for Unreal 5.5.# . Note
: Linux is still recommended for 18.1.0
Updated Quick Start Guide: Updated below to latest/correct info
New update Nov 30, 2024
Extension v2.6.1: For Unreal 5.2 and newer releases
- Changed Mac fix default setting
Also from older release:
- Has Unreal Source file support (
finally!
) see here - UE 5.5 support (
note:
now uses clang/clangd v18.1.0) - Potential Mac fix
- See Changelog for more info
-
This extension now uses UBT to
Refresh your project
to update Intellisense files(compile commands). So this runs when you run the'Update Compile Commands'
command. Since this refreshes your project, your project's *.code-workspace file will be refreshed removing your clangd settings and others! but... -
This extension will
automatically backup and restore
your clangd settings when you run theUpdate Compile Commands
command. -
Make sure not to use any other way to
Refresh
your project.
Note:
I've added a setting that allows you to add additional settings to be backed up.
See change log for more info: https://github.com/boocs/unreal-clangd/blob/v2/CHANGELOG.md#250-2024-05-05
This extension:
-
Provides fast Code Completion, Formatting, and other cool features!
-
Has a command to create a clangd project for you
-
Fixes some clangd/Unreal quirks
-
Has a uninstall command
Note:
Windows users can use clang/clangd for Intellisense and still build with Microsoft's compiler
-
Microsoft's C++
Needed for Building/Debugging
-
File Switcher
For Alt+O clangd keyboard shortcut (Head/Source switcher)
Using Clangd's Alt+O implementation is buggy, for Unreal Source files, so this extension is a good alternative -
C++ Create Definition (my extension)
Updated Sept 2023
-
[Unreal Reflection Function Parameters] (Deprecated) New project coming soonish
This is generally correct, when using non-full source, but your situation could be different.
- Read the Requirements section of the full Documentation
- Different Unreal Engine versions require different LLVM versions(Unreal 5.5 requires LLVM 18.1.0(Linux) and LLVM 18.1.8(Windows))
-
Install the vsix file from this github
(The vsix file can be downloaded from the
Releases
section on the right side column of this page. You might have to scroll up to see it.)
- Click the extensions icon
- Click the ellipsis (3 dots)
- Choose Install from VSIX...
- Ignore any VSCode warning messages (should go away after creating a project)
Linux:
In the next step(project creation), File Dialogues will spawn behind VSCode(known bug)
Note:
Make sure to read requirements! Different Unreal version usually require different clang/clangd
and XCode
versions
Windows Users:
The requirements sections has easy
instructions on how to install different Build Tools 2022 versions. These are required because other versions may cause fake red error squiggles
.
This version had some changes!
This hasn't been proven to work yet(let me know!)
.
There a new setting to try if you haven't been successful in getting clangd to work.
unreal-clangd.creation.MacFileLanguage
You can change the clangd Mac file language to C++ or Objective C++ (thanks to user szabot0412)
- The Objective C++ setting,
-xobjective-c++
, is a misnomer. It just means it will treat Objective C++ files as Objective C++ and C++ files as C++ - This setting is set in your .clangd files during project creation (.clangd file in project directory and Unreal directory)
- in the Add: section, it's the line that shows
- -xc++
or- -xobjective-c++
so if you want to test quickly with reinstalling. I believe- -xobjective-c++
is the correct one to use but I could be wrong!
Adding code or a space, in a header file, anywhere above the GENERATED_BODY macro will cause red squiggles. This is because the GENERATED_BODY macro uses the __LINE__ preprocessor macro.
- You'll need to Build your project to get rid of the red squiggles.
- Now you'll need to get clangd to reevaluate the file. See the Refresh File's Instellisense section below
- You can type a space in the file, wait half a second, and delete the space (this makes clangd reevaluate the file)
- You can also run the command clangd:
Restart language server
(on restart clangd will reevaluate the file) - Or you can close and reopen the file
The extension pulls the Unreal Uri from your project's *.code-workspace file. If you don't create a Unreal (VSCode) project then this file isn't created. You also must double click this file to open your project as a 'Workspace'. You can force Unreal to always create a VSCode project with a BuildConfiguration.xml file.
-
*.code-workspace file
-
When you double click on the file you'll see 'Workspace' in the VSCode title area:
-
When you open VSCode without a project, you'll get this screen which also tells you if you're opening as a 'Workspace'
I've run into this bug. Pressing control+space (Windows) will manually activate Code Completion. Look up your keyboard shortcut for your system.
If you add a plugin to *.build.cs you'll need to run the extension command to Update Compile Commands.
See this section for more info
- Double click on the UE5.code-workspace file in your Unreal directory
- Build the Editor inside VSCode
- Since you want to Launch it after it's done you can just use Run And Debug instead of Run Build Task. Unless you're heavily debugging you'll want to use the Development config.
- Once you set the above you can run it by hitting the F5 key or ctrl+F5 to run it without debugging.
- After it builds the Editor should run and you can now create a Full Source project.
- This is what pops up after I'm done compiling and it runs: (This is full source 5.4.1)
Thanks to user nmdMnk for the report!
- Unreal 5.4 on Windows requires clang
16.0.6
- Unreal 5.4's defaults are MSVC 14.38.33130 and Windows 10 SDK 10.0.18362.0 (according to 5.4 release notes)
- Trouble is Unreal 5.4 can and will use newer versions of MSVC and Windows 10 SDKs
- Newer MSVC versions require clang
18+
- So now you get errors if you have the updated C++ libraries.
This fix might work better if you're using Visual Studio Build Tools 2022 instead of relying on Visual Studio 2022's libraries.
Note:
This 'simple' fix isn't for everyone. Uninstalling and preventing newer C++ library updates is easy but might cause problems elsewhere. Also you might forget that you did this and, in the future, wonder why newer versions of Unreal aren't working.
The 2nd fix
, below this fix, takes a little more work but works within clangd to fix it.
1st Fix:
-
Simple fix would be to uninstall the newer C++ libraries and Windows 10 SDKs
-
The Visual Studio Installer allows you to do this
-
Check out the 2nd fix below for pictures of modifying the Visual Studio Installer
-
You will want to uninstall any MSVC versions above 14.38
-
Make sure to also remove the checkmark to always install the latest MSVC version
-
Also make sure to uninstall any Windows 10 SDKs above 10.0.18362.0
If you don't want to do the first fix this fix works within clangd to fix the problem. You won't have to worry about uninstalling anything.
-
Add this to both .clangd files (your project and Unreal directory) Add it to the 'Add' section.
Add: - /X - -fms-compatibility-version=19.38.33144 - /imsvcC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include - /imsvcC:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt - /imsvcC:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared - /imsvcC:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um - /imsvcC:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\winrt - /imsvcC:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\cppwinrt
-
All/some paths might be different so you'll have to adjust them (note the single backslash)
- Your path also might be different because you're using Visual Studio 2022 and not Visual Studio Build Tools like I am
- Visual Studio 2022 follows the same pattern as Visual Studio Build Tools 2022
- Here is a users example of the path he used for Visual Studio 2022
- /imsvcC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include
-
All version numbers are correct and you should probably use them
-
When you check the 5.4 release notes it says for Windows that MSVC 14.38.33130 and Windows 10 SDK 10.0.18362.0 are the default
-
You can download different MSVC versions from the Visual Studio Installer
-
You can download different Windows 10 SDKs from the Visual Studio Installer
-
/X was the key. It prevents clangd from pulling the version from a environmental variable
-
You can make sure -fms-compatibility-version=19.38.33144 is correct by doing
.\cl
in powershell. Here's what it looks like: -
Note:
5.5.# currently doesn't have this problem. If it does in the future, it actually has another include to use.- /imsvcC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\atlmfc\include\
So in the future this fix might need to adjust to the newer includes of future Unreal Engine releases.
To make Unreal Build Tool create a VSCode project by default you can use a BuildConfiguration.xml file. Here is the info about which directories you can create it in and what options are available.
https://dev.epicgames.com/documentation/en-us/unreal-engine/build-configuration-for-unreal-engine
Note:
On Windows I created the directory structure and xml file in my Documents folder (ME is my user name so it will be different for you):
E:\Users\ME\Documents\Unreal Engine\UnrealBuildTool\BuildConfiguration.xml
Here's a basic BuildConfiguration.xml (It's easy to create all this using VSCode)
<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
<ProjectFileGenerator>
<Format>VisualStudioCode</Format>
</ProjectFileGenerator>
</Configuration>