"Generate Visual Studio Project Files" did not auto-generate generated.h header files

Branch: Binary, from Launcher
Version: 4.7.3
System Specs: Alienware 13, Nvidia Geforce 860M, Windows 8.1

35929-no_generate_nearest.gif

While I was editing my code and building them, I got errors saying:

Error	1	error code: OtherCompilationError (2)	C:\Users\tom_m_000\Documents\Unreal Projects\get-debt\Intermediate\ProjectFiles\Error	GetDebt

And the output window says:

GetDebt/Objects/GetDebtWheelRear.h(16) : Expected an include at the top of the header: '#include "GetDebtWheelRear.generated.h"'

There is no “generated.h” header files in the project, as far as I can tell. I expected the “Generate Visual Studio Project files” option to actually generate everything, including “generated.h” header files the project needs.

But the actual result, as shown in the GIF above, shows otherwise. Hence the bug report.

Does anyone know how to fix this issue where the “generated.h” header files are missing from the project?

Does anyone know how to fix this issue where the “generated.h” header files are missing from the project?

Ok, I answered my own question.

To fix this:

  1. Open “Binaries” folder in the project root folder.
  2. Delete the folder in there.
  3. Re-arrange the source codes if you are re-organizing the file structures.
  4. “Generate Visual Studio project files” by right-clicking the UPROJECT file and selecting the option.
  5. Double click on the UPROJECT file.
  6. Open Unreal Engine 4 Editor to check to make sure the instanced code classes are re-organized to the way you wanted.

It is an issue, and the feature request has been made. Thread link here.

It also works when a new module is not exposed on the editor. I had tried add a new module into my project, but I got NewModuleHeader.generated.h.conflict file on [ProjectName]\Intermediate\Build\Win64\UE4Editor\Inc[NewModuleName] folder. I spent a few hours to find a solution, then I followed above instruction, magic! it works. My editor showed up new modules I had added. Thanks @asperatology

I know that this post is fairly old, but in the future when someone (ie myself) runs into a problem at step 5 not able to open up, and therefore unable to generate code, there is another error in your code, and the compiler will NOT find it, because it will crash while searching for generated .h files.

I spent about an hour on this before realizing that I had a syntax error on the file I was previously working on before I had to generate the files.

1 Like

Oh, so you have deleted the folder in the Binaries for UE4 to request a rebuild. (Right?)

Sometimes if you do not see any errors I find the best solution is to not rely on the unreal engine IDE but load up your c/c++ IDE like in visual studio and rebuild whole project there.

Reason being if you migrate from one version of engine to another the API often changes since the unreal engine now follow the same rule as game engine as a service.

even its labeled 4.x it will be constantly changing and even major releases where before if was following Major.Revision.Minor it would be in version 18.x by now lol

Hi can we open this topic up again cause I have the same problem, I regenerated the project and unreal and VS still cant find the generated.h, it’s a BTService and I keep getting the compile error: fatal error occurred : could not find BTService_FindPlayer.h. please help

Here is the code:

#pragma once

#include “CoreMinimal.h”
#include “BehaviorTree/BTService.h”
#include “BehaviorTree/BehaviorTreeComponent.h”
#include “BTService_FindPlayer.generated.h”

/**
*
*/
{
UCLASS()
class MyProject_API UBTService_FindPlayer : public UBTService;
}
{
GENERATED_BODY()
public:
UBTService_FindPlayer();
virtual void TickNode(UBehaviorTreeComponent & OwnerComp, uint8 * NodeMemory, float DeltaSeconds) override;

};

p.s I definetly have the Ai and gameplay module in my build.cs file