Fix bad path to header file when adding C++ class in the editor

I keep my C++ classes in MyProject/Source/MyModule/Classes folder to let the engine automatically collect my headers in MyProjectClasses.h file. If I add a new class to my project using the editor and define the path to my Classes folder, it places NewClass.h to Source/MyModule/Classes and NewClass.cpp to Source/MyModule/Private folder. But in automatically generated NewClass.cpp file it puts a line

#include "NewClass.h"

which is bad, because “NewClass.h” is not in the same folder. Well, actually it’s not a big problem, but I want to help to improve the engine ^_^.

Hi,

You should put your classes inside either a Public subfolder or a Classes subfolder, not both. Public is preferred, as support for the Classes subfolder is deprecated.

Please try placing your headers in MyProject/Source/MyModule/Public and seeing if that solves your problem.

Steve

I’m sorry for the confusion - I was lazy to check the paths and provided you with the wrong one (edited my post). Actually, I added a new class to MyProject/Source/MyModule/Classes folder. Adding a new class to the Public folder doesn’t cause this error, I’ve tried.

Why using Classes subfolder is deprecated? I liked it =(

The Classes folder is a legacy from UE3, and had some special behaviour associated with it. Public and Private are the new standard for UE4. We haven’t removed support for Classes yet, because lots of internal engine code still uses it. If you use Classes, you’ll tend to find odd cases like this, because we’re not actively supporting code which looks at that path.

Steve

Thanks for clarifying it =)