Cannot Open Source File errors continue w/ every new project

Every time I create new classes for new projects and try and access them through the editor, I inevitably run into this recurring baseline issue.

My build cannot be completed because my three “#include” declarations at the top can’t be recognized and my terminal claims it “cannot open source file” for these parts of my code.

I managed to accidentally figure out a fix for my last project, but it’s starting to frustrate me, repeatedly having this issue that I can’t really grasp and figure out a solution for.
My assumption is it’s something to do with the compiler itself; I have all extensions and what not installed. Please help, I’m finally grasping coding and this structural issue getting in my way is preventing me from really diving into the deep end.

Thank you in advance for any advice.

1 Like

Try “Tools” → “Refresh Visual Studio Project”.

3 Likes

I am having this problem too.
What (partly) worked for me:

Go to View > Command Palette > C/C++ Edit Configurations (UI) > UE5

Scroll down to “Include Path”
and enter the directory for your “Public” folder in Unreal Engine.

For example, for me this is
“C:\Program Files\Epic Games\UE_5.0\Engine\Source\Runtime\Core\Public”

I still have an error for the 3rd #include (line 7), but I’ve fixed 2/3 of the problem - that’s progress!

1 Like

And now for me it is fully resolved after going through the Run Build Task process - huzzah!

That actually resolved the “include” line issues, but is still claiming there’s a syntax error on the newly created files (haven’t changed anything yet eyeroll).

A bracket issue is lurking, I’m told.

1 Like

Update: This resolved my issue. The continued problem was a result of me typing the right thing in the wrong place. #Shame

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms