External File Use

Using UE5, I was able to Include a header from an external folder on my pc but that header had an include to another file which was in the same folder but UE could not find it. I saw that in previous versions you would do a PublicIncludePaths(List) but that is no longer the case with UE5 from what I’ve read. So…

#include “/dir1/dir2/dir3/file.hpp” <— found it! But on compile…
cannot find "/dir3/file2.hpp <— this is an #include of file.hpp

Please help me to solve this issue. I dont think I can install all of that external stuff into my project so I’d like it to remain external on my machine for now. Thank you.

CPP, Programming

Hey @a.carter1182, I’ve also seen this kind of issue regarding the scope of android projects, so maybe the fix for them might work for you as well:

It seems Unreal has a few checks for the locality of the files. It seems that using something other than the FPaths might work, as this discussion thread describes:

I hope some of these can help answer your question, let me know if it doesn’t!
-Zen :vulcan_salute:

Thanks for the reply I’ll have a look and get back to you!

1 Like

Thanks for the try but I havent found anything similar to that AndroidFile.cpp from what I have. I really dont have anything special its just a 3rd person template to try a few things but will heavily rely on pulling in some external stuff and its the first roadblock we expected to hit.

1 Like

@a.carter1182,
Sorry that it didn’t help! What I’m thinking now is you might need to change the world settings, there should be an option here to allow External Actors:


Other than that, I would recommend maybe checking out the One File Per Actor Docs, or the use of CoreMisc.h, that could be a way to learn some more about the reading and writing Unreal does:

I hope some of this can help, and let me know if you’re still having issues!
-Zen :vulcan_salute:

Ok so while the suggestions above didnt work out, I was able to get something going but its not 100%. But from the project.build.cs file I added in…
PublicSystemIncludePaths.Add(“/dir1/dir2/dir3”) and have been able to start accessing/reading the files I want. However, I do have to do an #include for every header file needed down the chain. Example:

file1
#include “dir3/file4.h”
#include “dir3/file3.h”
#include “dir3/file2.h”
#include “dir3/file1.h”

file1 includes external file2, and file2 includes external file3 and file3 includes external file4, and all the includes are being put into file1 and its working up til I have an include for a macro.h and then this solution stops working. I assume its how a macro.h file is written so I’m continuing to look some more

Hey @a.carter1182
I haven’t found much for free, but I’ve also been trying to find some plugins that may be worth some value to you:

Are the functions you’re trying to access static functions? I’ve seen issues without it being static when reading over files like this before.
I hope this can help!
-Zen