.generated.h: No such file or directory

Hi!

I’m using Unreal Engine 5.4.4.

In a project with two modules I’m getting this error in the secondary module:

C:\OpenDoorMultiplayer\Source\MultiplayerDoor\Public\DoorLeverInteract.h(7): fatal error C1083: Cannot open file: ‘DoorLeverInteract.generated.h’: No such file or directory

This is DoorLeverInteract.h:

#pragma once

#include "CoreMinimal.h"
#include "UObject/Interface.h"
#include "DoorLeverInteract.generated.h"

DECLARE_DYNAMIC_MULTICAST_DELEGATE(FLeverInteractMultiDelegate);

// This class does not need to be modified.
UINTERFACE(MinimalAPI)
class UDoorLeverInteract : public UInterface
{
	GENERATED_BODY()
};

/**
 * 
 */
class MULTIPLAYERDOOR_API IDoorLeverInteract
{
	GENERATED_BODY()

	// Add interface functions to this class. This is the class that will be inherited to implement this interface.
public:

	FLeverInteractMultiDelegate LeverInteractDelegate;
};

Any advice?

I have removed the Intermediate folder, recreate the class interface from Unreal Editor.

I get the error three times in file OpenDoorCharacter.cpp. Its header file is:

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "MultiplayerDoor/Public/DoorLeverInteract.h"
#include "OpenDoorCharacter.generated.h"

UCLASS()
class OPENDOORMULTIPLAYER_API AOpenDoorCharacter : public ACharacter, public IDoorLeverInteract

Maybe the problem is that these files are on different modules and OpenDoorCharacter can’t find file DoorLeverInteract.generated.h and the include in DoorLeverInteract.h should be #include "MultiplayerDoor/Public/DoorLeverInteract.generated.h" instead of #include "DoorLeverInteract.generated.h".

I don’t know.

Thanks!

If your modules are interdependent?
If so then in the target file you can add the needed module to the ExtraModulesNames array

so you can add the module MultiplayerDoor like this

ExtraModuleNames.Add("MULTIPLAYERDOOR");

There should be two lines the base module line and the dependent module line.

You may also add specific folders if you have sub-folders to your build file
example:

        PublicIncludePaths.AddRange(new string[] {
            "MainGameFolder",
            "MainGameFolder/Subfolder1",
            "MainGameFolder/Subfolder2",
            "MainGameFolder/Interfaces"
        });
1 Like

@3dRaven I have fixed the error adding the module to the file OpenDoorMultiplayer.Build.cs:


// Copyright Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;

public class OpenDoorMultiplayer : ModuleRules
{
	public OpenDoorMultiplayer(ReadOnlyTargetRules Target) : base(Target)
	{
		PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
	
		PublicDependencyModuleNames.AddRange(new string[]
		{
			"Core",
			"CoreUObject",
			"Engine",
			"InputCore",
			"OnlineSubsystem",
			"OnlineSubsystemUtils",
            "MultiplayerDoor"
        });

Thanks for you help!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.