[UE4] Error when trying to add new

Is it OK to use Visual Studio 2022 17.14.2 (latest) with the latest version of UE4? Because I get this error when trying to compile a new class via “New C++ class…”:

Successfully added class ‘item_base_class’, however you must recompile the ‘shrooms1i’ module before it will appear in the Content Browser. Failed to automatically hot reload the ‘shrooms1i’ module.

And I read in other threads that this error mostly caused by unfitting code editing software or missing development packages (idk how is it called, e.g. MC Visual C++ Redist).

When I tried to figure out what causing it, there is an error says that header file is missing (but it’s in the same directory as the source file)…

Opening header file in VS editor throws this many errors, so I’m completely overwhelmed and have no clue what to do/

image

Attaching the logs of compilation:

CompilerResultsLog: Building 8 actions with 12 processes...
CompilerResultsLog:   [1/8] test.cpp
CompilerResultsLog:   C:\Users\main\Documents\Unreal Projects\shrooms1i\Source\shrooms1i\test\test.cpp(4): fatal error C1083: Cannot open include file: 'test/test.h': No such file or directory
CompilerResultsLog:   [2/8] enemy_base_class.cpp
CompilerResultsLog:   C:\Users\main\Documents\Unreal Projects\shrooms1i\Source\shrooms1i\enemies\enemy_base_class.cpp(4): fatal error C1083: Cannot open include file: 'enemies/enemy_base_class.h': No such file or directory
CompilerResultsLog:   [3/8] base_item_class.cpp
CompilerResultsLog:   C:\Users\main\Documents\Unreal Projects\shrooms1i\Source\shrooms1i\Items\base_item_class.cpp(4): fatal error C1083: Cannot open include file: 'Items/base_item_class.h': No such file or directory
CompilerResultsLog:   [4/8] shrooms1i.init.gen.cpp
CompilerResultsLog:   [5/8] test.gen.cpp
LogMainFrame: MainFrame: Module compiling took 5.613 seconds
Warning: HotReload failed, recompile failed
Warning: RebindPackages failed because compilation failed.

In test.cpp change

#include "test/test.h"

With

#include "test.h"

Do the same with enemy_base_class.cpp

The 8k errors that’s just intelisense freaking out for no reason. Make sure you generate visual studio files again and then open visual studio, it should help with intelisense false flags.

But why isn’t not it there by default? I never would’ve thought to check… Is it still a compability problem?

edit: oh, I get why the compiler can’t find the file. is it not apropriate in ue to put classes into folders?

That’s a common issue when adding a new C++ class to a custom folder, I have it too and I’m not aware of a solution at the moment. I just have the habit of fixing the include every time I add a new class.

Is your problem solved ?

yes, thank you very much

1 Like