Download

VS2019 not finding header file fir project in subdirectory

Hi All,
I just got back into UE4 development.
I created a project outside UE4 engine folder and created a class under a new folder in the Source/ folder.
So, something like: PROJECT/Source/Test/PawnExtended(.h, .cpp)
When I do “Generate Project files” through the righ-click menu option and then go to build the game I get:
|Error|C1083|Cannot open include file: ‘Test/PawnExtended.h’: No such file or directory

I can solve this by adding the PROJECT into the cpp file #include path, but this didn’t used to be a problem in order versions of UE4 . is this a bug??

I think you need to add a module? If you add a C++ class from inside the editor, UE will set all this up for you. Source files go in /Source/ModuleName/Public|Private/.... Modules need a .build.cs in their root dir and I think they need to be added to the uproject file (uplugin for plugins). Then generate should work correctly.

Hi AliShug,

This isn’t a module, it’s a uproject game. The game itself was created as a C++ project through the editor. Also the code was added originall through the editor using the “Create new Class” option.
It seems odd that creating this through the editor would fail

All UE4 code including game project code must live in modules, unreal should have created at least one module for you if you set up the project as C++. It’s strange that your header isn’t in a Public directory, that might be what’s wrong.

Files should be like this, assuming your module is called “Test”:

Source/Test/Test.build.cs
Source/Test/Public/PawnExtended.h
Source/Test/Private/PawnExtended.cpp