Cannot open include file after switching to 4.26

I know I am missing something obvious, still very new to C++ and working with Visual Studio. I just tried moving my project to 4.26 and it won’t compile. I have a header in my root source directory STPObjects.h with implementations in a sub folder called objects. Intellisense does not have a problem finding the header when I look at the implementation source code however when I compile I get the fatal error C1083: Cannot open include file STPObjects.h. In Visual Studio I have gone to my project properties and manually added my root source file to the include path for good measure. It’s been awhile since I’ve worked on this project so I don’t even remember what I did initially to make this work. Using a directory structure should be trivial but I am missing something here.

My Directory Structure
…\Source\StarShipEmpire\STPObjects.h
…\Source\StarShipEmpire\objects\ObjectData.cpp ← Won’t compile because it can’t find STPObjects.h

1 Like

Generally this sounds like non-standard practice, but I think you can do something like:
#include “…/STPObjects.h”

have you tried to use #include “file_name.h” without the path. Thats what I use in my 4.26 project, in 4.24 I had to add include paths for each folder I included and when I remember correctly I couldnt include sub folders. On Epics C++ starting Guide I couldnt find any information on how to manage/stucture my cpp files.

edit: the #include looks relative from the current file, so when you want to include a file which is in the parent folder you would use …/file.h.

1 Like