when using the intellisense prompt of VS2022 to automatically include the header file in the code in the Cpp file, the following error always occurs
#include "../Config/UGConfigManager.h"
Is there any way to replace the path "../" with a full path? Like this:
#include "Game/Config/UGConfigManager.h"
EDIT: In UE5, you need to change NMake's IncludeSearchPath instead of VC Directories in Properties -> NMake
CodePudding user response:
You need to add an include path to the "Game" folder.
To set an include path you now must right-click a project and go to:
Properties -> VC Directories -> General -> Include Directories
Then add the include directory like so:
C:/foobar/Game
First try using an absolute path. And if that works you will want to use a Macro. Macros allow users to define paths without being specific to their own computer (So other people can use it).
Perhaps what you need is $(ProjectDir)
but I can't tell since I don't know where "Game" is relative to your project files.
But as an example:
$(ProjectDir)/Game
It's worth pointing out that what you are doing is interacting with the compiler option /I
on the MSVC compiler
. Visual Studio is just a gui abstracting it away for you.
Here are the docs on /I (Additional include directories)