Error When Creating a File Directory Directly From the C++ Class Wizard.

Created a brand new blueprint project, so no starting content/folders.

  • The very first thing I try to do is create a “Character” Class, set it to public, and directly create a new folder named “Characters” in the public directory from the C++ Class Wizard. The directory “Public/Characters” was not created prior to attempting to create the Character Class. **Screenshot provided. **

  • After creating the class, I get the warning about recompiling the “ProjectSand” module. Screenshot provided.

  • The Output Log returns this:

CompilerResultsLog: Building 9 actions with 6 processes…
CompilerResultsLog: [1/9] Default.rc2
CompilerResultsLog: [2/9] SharedPCH.Engine.ShadowErrors.cpp
CompilerResultsLog: [3/9] PSCharacterBase.cpp
CompilerResultsLog: C:\DEV\ProjectSand\Source\ProjectSand\Private\Characters\PSCharacterBase.cpp(4): fatal error C1083: Cannot open include file: ‘PSCharacterBase.h’: No such file or directory
CompilerResultsLog: [4/9] ProjectSand.cpp
CompilerResultsLog: [5/9] ProjectSand.init.gen.cpp
CompilerResultsLog: [6/9] PSCharacterBase.gen.cpp

  • I read solutions online. Here are some I have tried:

    • Solution 1: Attempt to build the project directly in UE4.

      • Results: The file directories still do not appear in the content browser.

    • Solution 2: Close out the UE4 project, open and build the VS project directly.

      • Results: Output window returns this:

1>Building 4 actions with 6 processes…
1> [1/4] PSCharacterBase.cpp
1>C:\DEV\ProjectSand\Source\ProjectSand\Private\Characters\PSCharacterBase.cpp(4): fatal error C1083: Cannot open include file: ‘PSCharacterBase.h’: No such file or directory
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets(44,5): error MSB3075: The command ““C:\Program Files\Epic Games\UE_4.24\Engine\Build\BatchFiles\Build.bat” ProjectSandEditor Win64 Development -Project=“C:\DEV\ProjectSand\ProjectSand.uproject” -WaitMutex -FromMsBuild” exited with code 5. Please verify that you have sufficient rights to run this command.
1>Done building project “ProjectSand.vcxproj” – FAILED.
**========== Build: 0 succeeded, 1 failed, 0 up-to-date, 1 skipped ========== **​​​​​​​

I have provided a screen shot of my solution explorer as well as the PSCharacterBase.cpp file.

Before I give my closing remarks, I am following this tutorial here: C++ Character Class Creation UE4 / Unreal Engine 4 C++ - YouTube

The part I am talking about is at the 4:30 mark. It is from nearly a year ago, so it is very possible a procedure that worked then, doesn’t now. So I know it is possible, but I guess I cannot go about it the same way.

My problem seems to lie in the fact that I created a file directory directly from the C++ Class Wizard when creating a new Class, instead of establishing the folder first. I would have established the folder first, however UE4 tells me that I cannot directly add folders to the public directory. My problem also seems to lie within the .cpp file. My .cpp file in the private directory can’t seem to access the .h file within the public directory. The private and public files named “Characters” clearly exist as they are in the solution explorer, however in the .cpp file, the header file cannot be located/opened. I understand where my problem is, however I cannot seem to come up with the solution. I’ve been around the web for a few hours now trying to figure this out, but nothing has worked for me. I wouldn’t have posted if I did not do my due diligence and search for a solution first. I didn’t even find anything similar on the forums. I also am not sure if this problem belongs in this section, so I apologize if it doesn’t belong here.

Please let me know if you have any thoughts or solutions on this matter. Thank you for your time!

You can create a folder/directory directly from C++ wizard it has no harm. But in that case you need to add following code into your .Build.cs as

PublicIncludePaths.AddRange(new string[] { "<Project_Name>" });

Reason behind this, UE uses .Net for compiling your C++ source code. You just indicate .net that you are also including path that project source code located.

1 Like