Download

Unable to create C++ Classes Unreal 4.25

Evening

I was wondering if some one would be able to help me, I have tried searching the forum and web and to do what other people have done who have had similar issues.

When I make a new class it always tells me that the module cannot be created and when in Visual Studio the header file directory cannot be found. I’m currently using 4.25 and I can’t seem to get around the issue. I’ve tried re generating the VS files, ensuring the the files are inherited from parent etc when needed. Eventually on trying to open VS it tells me Unreal cannot open and It’s the wrong version.

I’ve also got 4.22 installed and that works just fine in creating new C++ classes.

I’m honestly lost at what to try next. Any help is much appreciated.

Hi @MrGriffiths ,
Could you post what appears in Output Log when you create a new class? ( Windows > Develeper Tools > Output Log )
What may be happening is that you are creating the class in a subfolder, I usually do this, so you need to open the .cpp file and “fix” the .h location:


#include "Folder/<MyNewClass>.h"

Thanks for your reply @SolidSk . I appear to have hit two separate issues.

Issue one is - UE-92876. This has caused me some headaches But there is an easy work around. Creating new classes in sub folders works fine now as long as I don’t set them to public/private.

Thank the lord!

However following what you said , when I create a class derived from another class it still throws an error regarding the module. I have found a fix for this however and it differs from what you advise. On opening the new class which failed to reload I need to remove the sub folder from the .h file for it to compile. So changing Characters/Characters.h to just characters on the new class ( which is derived from another class) it works fine.

I’m still not sure why it cannot find the sub folder despite deriving from an existing class, seems a bit odd!

Here is my log -

Launching UnrealBuildTool… [C:/Program Files/Epic Games/UE_4.25/Engine/Binaries/DotNET/UnrealBuildTool.exe -ModuleWithSuffix=MyProject2,1061 MyProject2Editor Win64 Development -Project=“L:/TEstAgain/MyProject2/MyProject2.uproject” “L:/TEstAgain/MyProject2/MyProject2.uproject” -IgnoreJunk]
CompilerResultsLog: New page: Compilation - 27 May 2020, 09:53:38
CompilerResultsLog: Invalidating makefile for MyProject2Editor (source file added)
CompilerResultsLog: Parsing headers for MyProject2Editor
CompilerResultsLog: Running UnrealHeaderTool “L:\TEstAgain\MyProject2\MyProject2.uproject” “L:\TEstAgain\MyProject2\Intermediate\Build\Win64\MyProject2Editor\Development\MyProject2Editor.uhtmanifest” -LogCmds=“loginit warning, logexit warning, logdatabase error” -Unattended -WarningsAsErrors -abslog=“C:\Users\gllm\AppData\Local\UnrealBuildTool\Log_UHT.txt”
-installed
CompilerResultsLog: Reflection code generated for MyProject2Editor in 4.7708729 seconds
CompilerResultsLog: Building MyProject2Editor…
CompilerResultsLog: Using Visual Studio 2019 14.26.28805 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801) and Windows 10.0.18362.0 SDK (C:\Program Files (x86)\Windows Kits\10).
CompilerResultsLog: Building 6 actions with 12 processes…
CompilerResultsLog: [1/6] MyProject2.init.gen.cpp
CompilerResultsLog: [2/6] test.cpp
CompilerResultsLog: [3/6] test.gen.cpp
CompilerResultsLog: [4/6] UE4Editor-MyProject2-1061.lib
CompilerResultsLog: Creating library L:\TEstAgain\MyProject2\Intermediate\Build\Win64\UE4Editor\Development\MyProject2\UE4Editor-MyProject2-1061.lib and object L:\TEstAgain\MyProject2\Intermediate\Build\Win64\UE4Editor\Development\MyProject2\UE4Editor-MyProject2-1061.exp
CompilerResultsLog: [5/6] UE4Editor-MyProject2-1061.dll
CompilerResultsLog: Creating library L:\TEstAgain\MyProject2\Intermediate\Build\Win64\UE4Editor\Development\MyProject2\UE4Editor-MyProject2-1061.suppressed.lib and object L:\TEstAgain\MyProject2\Intermediate\Build\Win64\UE4Editor\Development\MyProject2\UE4Editor-MyProject2-1061.suppressed.exp
CompilerResultsLog: [6/6] MyProject2Editor.target
CompilerResultsLog: Total time in Parallel executor: 1.22 seconds
CompilerResultsLog: Total execution time: 7.74 seconds
LogMainFrame: MainFrame: Module compiling took 7.812 seconds
LogClass: Could not find existing class test in package /Script/MyProject2 for HotReload, assuming new class
LogContentBrowser: Native class hierarchy updated for ‘MyProject2’ in 0.0003 seconds. Added 4 classes and 3 folders.
Display: HotReload successful (0 functions remapped 0 scriptstructs remapped)
LogContentBrowser: Native class hierarchy populated in 0.0095 seconds. Added 3430 classes and 823 folders.
Display: HotReload took 7.9s.
Warning: HotReload operation took 7.9s.
LogVSAccessor: Warning: Couldn’t goto line number ‘1’ in ‘L:/TEstAgain/MyProject2/Source/MyProject2/Characters/test.h’
LogVSAccessor: Warning: Couldn’t goto line number ‘1’ in ‘L:/TEstAgain/MyProject2/Source/MyProject2/Characters/test.cpp’
LogSlate: Window ‘Add C++ Class’ being destroyed
LogHotReload: New module detected: UE4Editor-MyProject2-1061.dll
LogHotReload: Starting Hot-Reload from IDE
LogContentBrowser: Native class hierarchy updated for ‘MyProject2’ in 0.0003 seconds. Added 4 classes and 3 folders.
Display: HotReload successful (0 functions remapped 0 scriptstructs remapped)
LogContentBrowser: Native class hierarchy populated in 0.0079 seconds. Added 3430 classes and 823 folders.
Display: HotReload took 0.1s.
LogSlate: WidgetSwitcher (‘None’) active index changed to -1
LogSlate: WidgetSwitcher (‘None’) active index changed to 1
Candidate modules for hot reload:
MyProject2
Launching UnrealBuildTool… [C:/Program Files/Epic Games/UE_4.25/Engine/Binaries/DotNET/UnrealBuildTool.exe -ModuleWithSuffix=MyProject2,6281 MyProject2Editor Win64 Development -Project=“L:/TEstAgain/MyProject2/MyProject2.uproject” “L:/TEstAgain/MyProject2/MyProject2.uproject” -IgnoreJunk]
CompilerResultsLog: New page: Compilation - 27 May 2020, 09:53:52
CompilerResultsLog: Invalidating makefile for MyProject2Editor (source file added)
CompilerResultsLog: Parsing headers for MyProject2Editor
CompilerResultsLog: Running UnrealHeaderTool “L:\TEstAgain\MyProject2\MyProject2.uproject” “L:\TEstAgain\MyProject2\Intermediate\Build\Win64\MyProject2Editor\Development\MyProject2Editor.uhtmanifest” -LogCmds=“loginit warning, logexit warning, logdatabase error” -Unattended -WarningsAsErrors -abslog=“C:\Users\gllm\AppData\Local\UnrealBuildTool\Log_UHT.txt”
-installed
CompilerResultsLog: Reflection code generated for MyProject2Editor in 4.8230039 seconds
CompilerResultsLog: Building MyProject2Editor…
CompilerResultsLog: Using Visual Studio 2019 14.26.28805 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801) and Windows 10.0.18362.0 SDK (C:\Program Files (x86)\Windows Kits\10).
CompilerResultsLog: Building 6 actions with 12 processes…
CompilerResultsLog: [1/6] Mytest.cpp
CompilerResultsLog: L:\TEstAgain\MyProject2\Source\MyProject2\Characters\Mytest.h(6): fatal error C1083: Cannot open include file: ‘Characters/test.h’: No such file or directory
CompilerResultsLog: [2/6] Mytest.gen.cpp
CompilerResultsLog: L:\TEstAgain\MyProject2\Source\MyProject2/Characters/Mytest.h(6): fatal error C1083: Cannot open include file: ‘Characters/test.h’: No such file or directory
CompilerResultsLog: [3/6] MyProject2.init.gen.cpp
LogMainFrame: MainFrame: Module compiling took 7.144 seconds
Warning: HotReload failed, recompile failed
Warning: RebindPackages failed because compilation failed.
LogSlate: Window ‘Message’ being destroyed
Message dialog closed, result: Yes, title: Message, text: Successfully added class ‘Mytest’, however you must recompile the ‘MyProject2’ module before it will appear in the Content Browser. Failed to automatically hot reload the ‘MyProject2’ module.
Would you like to open the Output Log to see more details?
LogSlate: Window ‘Add C++ Class’ being destroyed
LogHotReload: New module detected: UE4Editor-MyProject2-0005.dll
LogHotReload: Starting Hot-Reload from IDE
LogClass: Could not find existing class Mytest in package /Script/MyProject2 for HotReload, assuming new class
LogContentBrowser: Native class hierarchy updated for ‘MyProject2’ in 0.0003 seconds. Added 5 classes and 3 folders.
Display: HotReload successful (0 functions remapped 0 scriptstructs remapped)
LogContentBrowser: Native class hierarchy populated in 0.0080 seconds. Added 3431 classes and 823 folders.
Display: HotReload took 0.1s.
LogSlate: Window ‘Output Log’ being destroyed

@MrGriffiths I created an empty C++ project, then I created a new C++ class inheriting from ACharacter in Characters subfolder ( I didn’t set public/private ). I didn’t have to change the code like you said. The difference of our logs was here:

LogVSAccessor: Warning: Couldn’t goto line number ‘1’ in ‘L:/TEstAgain/MyProject2/Source/MyProject2/Characters/test.h’
LogVSAccessor: Warning: Couldn’t goto line number ‘1’ in 'L:/TEstAgain/MyProject2/Source/MyProject2/Characters/test.cpp’

I don’t know what it can be, but on this page the error is similar:
https://answers.unrealengine.com/que…disappear.html

About the error:

CompilerResultsLog: L:\TEstAgain\MyProject2\Source\MyProject2\Characters\Mytest.h(6): fatal error C1083: Cannot open include file: ‘Characters/test.h’: No such file or directory
You need to correct the .h path in the .cpp file. This error is what always happens to me.

I hope it helps