[UPDATE] LNK1181 Error: cannot open input file 'C:\Program Files\Epic Games\UE_4.15\Engine\Binaries\Win64\UE4-UMGEditor.lib'

[UPDATE]

So, after going through all of my files, I did find one preprocessor include directive that referenced “Blueprint.h”. I removed it, but am still getting errors, although different. The project still compiles successfully with Editor build configurations.

191916-vserror1.png

New Error: LNK1181: cannot open input file 'C:\Program Files\Epic Games\UE_4.15\Engine\Binaries\Win64\UE4-UMGEditor.lib'

Any advice would be appreciated.


ORIGINAL ISSUE:

Error: C1083 Cannot open include file: ‘WidgetBlueprint.generated.h’: No such file or directory

So this is kind of a weird one for me. I’ve experienced similar issues like this before, but this time I have a large project relying on it, so I can’t exactly rebuild the project to get around this issue. I’m hoping someone can help me with this issue.

Everything works great if I build the project with the Editor, but get this error when trying to package or build without the editor.

Build Configurations that work: Debug Game Editor, Development Editor
Build Configurations that cause errors: Debug Game, Development, Shipping

My Project Build.cs file:

// Fill out your copyright notice in the Description page of Project Settings.

using UnrealBuildTool;

public class Project : ModuleRules
{
	public Project(TargetInfo Target)
	{
		PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "MySQL", "UMG", "UMGEditor", "Slate", "SlateCore" });

		PrivateDependencyModuleNames.AddRange(new string[] {  });

		// Uncomment if you are using Slate UI
		 PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
		
		// Uncomment if you are using online features
		 PrivateDependencyModuleNames.Add("OnlineSubsystem");

		// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
	}
}

I believe I have all the necessary modules needed to use UMG. I have created an extended UserWidget C++ class that doesn’t inherit from WidgetBlueprint.h, but rather from UserWidget.h as should.

Extended Widget Blueprint class that I build:

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "Blueprint/UserWidget.h"
#include "MySQLEngine.h"
#include "Project_WindowsOS.h"
#include "Project_ExtendedWidgetBlueprint.generated.h"

/**
 * 
 */

UENUM(BlueprintType)
enum class EPaginationArrowDirection : uint8
{
	NONE UMETA(DisplayName="None"),
	ARROW_LEFT UMETA(DisplayName="Left Arrow"),
	ARROW_RIGHT UMETA(DisplayName="Right Arrow")
};

UCLASS()
class PROJECTDEV_API UProject_ExtendedWidgetBlueprint : public UUserWidget
{
	GENERATED_BODY()
	
	MySQLEngine sqlInterface;

public:
	UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Custom)
		FString MachineName;

	UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Custom)
		FString StationName;

	UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Custom)
		TArray<FString> AllListedMachines;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Custom|Pagination")
		EPaginationArrowDirection PaginationArrowDirection;
		
	UFUNCTION(BlueprintCallable, Category = Custom)
		FString GetMachineName();

	UFUNCTION(BlueprintCallable, Category = Custom)
		TArray<FString> GetAllSimulatorMachines();

	UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "Custom|Pagination")
		void DeactivateAllPaginations();
};

Maybe I’m just missing something, but it doesn’t make sense to me why my project compiles for Editor builds, but won’t package or work with any other builds. Any help would be most grateful. Thank you in advanced!

If you guys need any extra information or project files, let me know and I’ll have them uploaded.

I am a little limited on what I can send for this project due to an NDA I had to sign.

[SOLVED]

Alright, so for anyone having any of the aforementioned issues, I finally figured out what was causing the problems.

I would also like to credit this posting for helping me weed out the issues: https://answers.unrealengine.com/questions/3533/bug-lnk1181-cannot-open-input-file.html

If you are experiencing Error: C1083 Cannot open include file: ‘WidgetBlueprint.generated.h’: No such file or directory, then somewhere in your c++ code, you have tried including “BlueprintWidget.h”. It took me a few hours, but I finally figured out my mistake. If you say you haven’t used it, look again just to be sure, because I was on that bandwagon as well and ended up finding where I used it. Mistakes happen, especially when doing large projects, so don’t feel bad if 90% of your UserWidget extensions correctly use “Blueprints/UserWidget.h” and you accidentally include “Blueprint.h” on one of your header files.

If you are experiencing LNK1181: cannot open input file ‘C:\Program Files\Epic Games\UE_4.15\Engine\Binaries\Win64\UE4-UMGEditor.lib’ on Development, Shipping, or DebugGame builds, then make sure that in your “Project.Build.cs” file, you have either removed “UMGEditor” or added an if statement to dynamically add UMGEditor on Editor builds only.

Here is an example of the correct project.Build.cs solution:

 using UnrealBuildTool;
    
    public class MyProject : ModuleRules
    {
    	public MyProject(TargetInfo Target)
    	{
    		PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "MySQL", "UMG", "Slate", "SlateCore" });

// ONLY ADD UMGEditor IF UEBuildConfiguration.bBuildEditor IS TRUE. OTHERWISE, DON'T INCLUDE DEPENDENCY MODULE ON NON-EDITOR BUILDS.
            if(UEBuildConfiguration.bBuildEditor)
            {
                PublicDependencyModuleNames.AddRange(new string[] { "UMGEditor" });
            }
    
    		PrivateDependencyModuleNames.AddRange(new string[] {  });
    
    		// Uncomment if you are using Slate UI
    		 PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
    		
    		// Uncomment if you are using online features
    		 PrivateDependencyModuleNames.Add("OnlineSubsystem");
    
    		// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
    	}
    }

With the main focus being here:

 if(UEBuildConfiguration.bBuildEditor)
    {
        PublicDependencyModuleNames.AddRange(new string[] { "UMGEditor" });
    }

Yeah, that ended up being the issue. Thank you for your response! Just hoping this will help someone who runs into this same scenario in the future.

Have you tried removing “UMGEditor” from your list of modules?

I’m able to create custom UserWidgets just fine, and I’m not including that module. Your widget and Build.cs look similar to mine otherwise.

Glad that fixed it, and thanks for typing up a detailed google-able response! It helps out everyone. :slight_smile:

I get the same problem, And I hit WidgetBlueprint.generated.h’: No such file or directory…
But I need WidgetBlueprint.h to do this:

    	static ConstructorHelpers::FObjectFinder<UWidgetBlueprint> InventoryWidgetBPContainter(TEXT("WidgetBlueprint'/Game/Widgets/BP_InventoryWidget.BP_InventoryWidget'"));

How could I solve this question without delete it?

i have the same “LNK1181: cannot open input file ‘C:\Program Files\Epic Games\UE_4.15\Engine\Binaries\Win64\UE4-UMGEditor.lib’” error. I don’t have UMGEditor Dependency on my Project.Build.cs file(also tried adding one in if statement). Still gets the same error when packaging the game. What should i do?