Hello all.
I have been searching for a solution for this problem, where generating an Visual Studio solution (by right-clicking on the .uproject) does not fill in the Include Directories for the engine source files. This results in all my .h and .cpp having errors because they can’t include core files for its most basic functions or macros.
This issue wasn’t happening a few days ago, where I was able to open generate the project files without any sort of problem and continue coding as I was. Did I change any settings that are important and I didn’t notice?
I have tried reinstalling Unreal Engine (5.2), Visual Studio 2022, rebooting my PC and none of it has worked. I also tried deleting the project and downloaded it again from its GitHub repository and it didn’t worked (it works for my friends who are working on the same repository as me).
I also encounter this issue with the manually compiled version of Unreal Engine, and the only fix i found for now was to manually retrieve all the missing include and source folders and manually add them in the IncludePath and SourcePath of my .vcxproj file.
Here’s the python script i used for anyone interested:
import pathlib
import os
# Replace the content between the quotes with the path to your UnrealEngine's `Engine/Source/Runtime` folder
base_source_runtime = pathlib.Path("E:\\UnrealEngine\\Engine\\Source\\Runtime")
# Same thing with the path to your UnrealEngine's `Engine/Plugins` folder
base_plugin = pathlib.Path("E:\\UnrealEngine\\Engine\\Plugins")
with open("includes_plugins.txt", "w") as f:
f.write(";".join([str(pu) for pu in set([p.parent for p in base_plugin.rglob("*.cpp")])]))
with open("includes_source_runtime.txt", "w") as f:
f.write(";".join([str(pu) for pu in set([p.parent for p in base_source_runtime .rglob("*.cpp")])]))
Then you need to add the long line from the includes_source_runtime.txt and the long line from the includes_plugins.txt, that were just created, in the IncludePath and SourcePath sections of your .vcxproj file for your project.
That seems really dirty, but it seems to work. I also couldn’t find a better way to fix this, after searching the internet for a while.
In case it helps anyone, one possible settingbGenerateIntelliSenseData false has this behavior with Generate Visual Studio project files where your .vcxproj file IncludePath no longer gets filled.
You can see from Engine\Programs\UnrealBuildTool\Log_GPF.txt that it mentions which BuildConfiguration.xml is being read from, and then if bGenerateIntelliSenseData is configured false, then the IntelliSense step is skipped.