New UE5 c++ project cannot find header files and open source file in visual studio 2019

I am curious how to fix this. As soon as I open a new c++ project and enter visual studio, and the solution finished compiling, I receive around 10 000 errors stating cannot open sources files, the likes of CoreMinimal.h.

Basically, it worked both fine with visual studio 2019 and Unreal Engine 4.27,
also, it worked with Visual studio 2019 and Unreal Engine 5.0 Early access without any problem,

But with the official release of Unreal Engine 5, as soon as I create a new project or upgrade an existing project to UE5, Visual studio suddenly cannot find header files, Giving me between 7000 and 12000 errors. Not what I like to see on a new project.

Before anyone propose the solution of generating the source files, I already followed those steps without any changes.
Cannot open source file name.generated.hc.

I also try manually placing the directory location, in option / NMake / Include Search Path, it also did nothing.

Code error E1696

12 Likes

Hi, I have the same issue and I could not solve it. Did you find how?

Yuup, exact same issue here. And I guess because of this, but my intelisense is reeeeeealy slow (takes minutes) and so is my build time from UE. Feels wrong (VS 2019)

I did not find how to fix the error of not finding the header files, but I since learned that the workflow is really different from my experience with Unity, while Unity compile the solution each time I saved a script, by following a udemy tutoriel with unreal engine 5, it seems each time i am really ready to compile, i must close the Unreal project, and then compile in visual studio,

I have also been recommended to completely disregard Intelisense, So yeah…
still works but seems weird but i got used to it.

I’m having the exact same issue, I ported my project to UE5 and the header files don’t seem linked. The compiler doesn’t find them and right-clicking “Go-To Document” fails to find the header, despite the path being correct.

I fixed this by upgrading the windows 10 sdk. In VS installer, select game development, and uncheck win10 sdk 19.something and select the latest win10 sdk which for me was 22.something. You can probably leave 19 installed if you need it, but I didn’t.

Didn’t work for me but thanks for sharing.

Can Epic maybe fix this so that coding in the only language they let us code in isn’t the worst possible experience? Remember when they used to tell people to straight-up disable IntelliSense? Are we going back to those days so I can have lighting that looks good at 2 fps from a still camera and still shows temporal artifacting? Sure seems like the priorities are in check

3 Likes

I just looked closer and you’re right it didn’t fully work for me either. I have 1100+ warnings and 11 errors instead of 1200+ errors after the SDK change but intellisense is working now regardless. Building inside VS also works despite the 10 errors. All I was trying to fix was colorizing the code so I’m happy.

I played with the includePaths some more since it was giving multiple definitions when it shouldn’t.

I updated includePaths to look like:

{
...
"ue5IncludePathHack": [
            "${workspaceFolder}/**",
            "<path to ue5 repo>/UnrealEngine/Engine/Source/Runtime/Core/Public/**",
            "<path to ue5 repo>/UnrealEngine/Engine/Source/Runtime/CoreUObject/Public/**"
        ]

...
}

I have a imperfect workaround for VSCode until they fix this problem. It seems like VSCode needs some guidance on where to look. I updated my c_cpp_properties.json to look something like this:

{
    "env": {
        "ue5IncludePathHack": [
            "${workspaceFolder}/**",
            "<path to ue5 repo>/UnrealEngine/Engine/Source/**"
        ]
    },
    "configurations": [
        {
            "name": "scarEditor Editor Linux Development (scar)",
            "intelliSenseMode": "linux-gcc-x64",
            "cppStandard": "gnu++17",
            "compilerPath": "/usr/bin/gcc",
            "includePath": ["${ue5IncludePathHack}"],
            "browse": {
              "limitSymbolsToIncludedHeaders": true,
              "databaseFilename": ""
            }
        },
        {
            "name": "Linux",
            "intelliSenseMode": "linux-gcc-x64",
            "cStandard": "gnu17",
            "cppStandard": "gnu++17",
            "compilerPath": "/usr/bin/gcc",
            "includePath": ["${ue5IncludePathHack}"],
            "browse": {
              "limitSymbolsToIncludedHeaders": true,
              "databaseFilename": ""
            }
        }
    ],
    "version": 4
}

Its not perfect… this allows intellisense to work but might see some complaints in ue5 source files. However, it seems to be close enough to how it was for ue4.

Also, you’ll have to reset this file after clicking on “Refreshing Visual Studio Code” in UE5 Editor.

Hope this helps

I disabled Live Coding. The errors are still there but I can build now.

For me, it fails to build anything related to windows.h files or win32 files. cannot bitmap or do sockets or anything related to headers and linking does not help. I don’t know if this is related to your issue but UE5 only seems to work with its own header files which is massively limiting a lot of projects who saw potential with coding in cpp.

Same problem with both fresh install of UE5 and 5.3 with VScode. Is there a general fix / faq for this please? I’ve tried editing paths, to no avail, and usually just end up breaking the project so it won’t load.

1 Like

Have you solved the problem? I also created a C++class in the blueprint project, which directly caused the inability to find header files such as coremini. h, and the project was scrapped

This worked for me:

c++ - Visual Studio Code/Intellisense cannot find Unreal Engine CoreMinimal.h file - Stack Overflow

Had same in brand new Unreal Project. The Solution explorer complained it couldnt find the engine sources, Nor the games generated source files it generated.
Building and clean and rebuild all sucessful but no Intellisense.

To fix for me, in the UE Editor, with Visual studio closed.

Select Tools-> New C++ class,
select public , All classes → Object.
Called it temp as I am going to delete later.
Create the class and select to open in Visual Studio.
On opening it then popped up about linking in other projects, and solution to link the UE source projects and then find the generated Character and Game mode headers.
Closed everything and repoened just to be sure and still picked up everything.