LNK1104 when Packaging project with C++ Code

Hello!

The project that I have been working on for a while is finally finished! (hooray) When I try to package the project to its own stand-alone game I keep getting a fatal error that causes the packaging to fail. I have tried everything that I could find and nothing has helped. We have a few classes that have been written in VS2013 Community and a plugin to recognize a logitech driving controller (wheel and pedals).

We have tried making a new project with NO custom classes and it was able to package, but if we add a single custom C++ class to the project it will no longer build. I have literally added a new custom actor class, made no changes to the base class and then tried to build and was returned with a fatal error so I’m lead to believe its something to do with our VS or how I am trying to package the project. We are using VS2013 Community and UE4.7.6.

I am building for Development 64 Bit. The error is LNK1104:


MainFrameActions: Packaging (Windows (64-bit)): UnrealBuildTool: WheelLib.lib(MyWheelLib.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
MainFrameActions: Packaging (Windows (64-bit)): UnrealBuildTool: LINK : fatal error LNK1104: cannot open file 'C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x64\xinput.LIB'
MainFrameActions: Packaging (Windows (64-bit)): UnrealBuildTool: -------- End Detailed Actions Stats -----------------------------------------------------------
MainFrameActions: Packaging (Windows (64-bit)): UnrealBuildTool: ERROR: UBT ERROR: Failed to produce item: C:\Users\Synapse\Desktop\Unreal  Rocks\Protato\Binaries\Win64\Protato.exe
MainFrameActions: Packaging (Windows (64-bit)): UnrealBuildTool: Cumulative action seconds (8 processors): 0.00 building projects, 48.79 compiling, 0.00 creating app bundles, 0.00 generating debug info, 33.03 linking, 0.00 other
MainFrameActions: Packaging (Windows (64-bit)): UnrealBuildTool: UBT execution time: 97.06 seconds
MainFrameActions: Packaging (Windows (64-bit)): CommandUtils.Run: Run: Took 97.1945592s to run UnrealBuildTool.exe, ExitCode=2
MainFrameActions: Packaging (Windows (64-bit)): ErrorReporter.Error: ERROR: AutomationTool error: Command failed (Result:2): C:\Program Files\Epic Games\4.7\Engine\Binaries\DotNET\UnrealBuildTool.exe Protato Win64 Development  "C:\Users\Synapse\Desktop\Unreal  Rocks\Protato\Protato.uproject"  -noxge -rocket -NoHotReloadFromIDE. See logfile for details: 'UnrealBuildTool.txt' 
MainFrameActions: Packaging (Windows (64-bit)): BuildCommand.Execute: ERROR: BUILD FAILED
MainFrameActions: Packaging (Windows (64-bit)): Program.Main: ERROR: AutomationTool terminated with exception:
MainFrameActions: Packaging (Windows (64-bit)): Program.Main: ERROR: Exception in AutomationTool: Command failed (Result:2): C:\Program Files\Epic Games\4.7\Engine\Binaries\DotNET\UnrealBuildTool.exe Protato Win64 Development  "C:\Users\Synapse\Desktop\Unreal  Rocks\Protato\Protato.uproject"  -noxge -ro
MainFrameActions: Packaging (Windows (64-bit)): cket -NoHotReloadFromIDE. See logfile for details: 'UnrealBuildTool.txt' 
MainFrameActions: Packaging (Windows (64-bit)): Stacktrace:    at AutomationTool.CommandUtils.RunAndLog(String App, String CommandLine, String Logfile, Int32 MaxSuccessCode, String Input, ERunOptions Options, Dictionary`2 EnvVars)
MainFrameActions: Packaging (Windows (64-bit)):    at AutomationTool.CommandUtils.RunUBT(CommandEnvironment Env, String UBTExecutable, String CommandLine, String LogName, Dictionary`2 EnvVars)
MainFrameActions: Packaging (Windows (64-bit)):    at AutomationTool.UE4Build.BuildWithUBT(String ProjectName, String TargetName, UnrealTargetPlatform TargetPlatform, String Config, String UprojectPath, Boolean ForceMonolithic, Boolean ForceNonUnity, Boolean ForceDebugInfo, Boolean ForceFlushMac, Boolean DisableXGE, String InAddArgs, Boolean ForceUnity, Dictionary`2 EnvVars)
MainFrameActions: Packaging (Windows (64-bit)):    at AutomationTool.UE4Build.Build(BuildAgenda Agenda, Nullable`1 InDeleteBuildProducts, Boolean InUpdateVersionFiles, Boolean InForceNoXGE, Boolean InForceNonUnity, Boolean InForceUnity, Dictionary`2 PlatformEnvVars)
MainFrameActions: Packaging (Windows (64-bit)):    at Project.Build(BuildCommand Command, ProjectParams Params, Int32 WorkingCL)
MainFrameActions: Packaging (Windows (64-bit)):    at BuildCookRun.DoBuildCookRun(ProjectParams Params)
MainFrameActions: Packaging (Windows (64-bit)):    at BuildCommand.Execute()
MainFrameActions: Packaging (Windows (64-bit)):    at AutomationTool.Automation.Execute(List`1 CommandsToExecute, CaselessDictionary`1 Commands)
MainFrameActions: Packaging (Windows (64-bit)):    at AutomationTool.Automation.Process(String] CommandLine)
MainFrameActions: Packaging (Windows (64-bit)):    at AutomationTool.Program.MainProc(Object Param)
MainFrameActions: Packaging (Windows (64-bit)):    at AutomationTool.InternalUtils.RunSingleInstance(MainProc Main, Object Param)
MainFrameActions: Packaging (Windows (64-bit)):    at AutomationTool.Program.Main()
MainFrameActions: Packaging (Windows (64-bit)): Program.Main: ERROR: Command failed (Result:2): C:\Program Files\Epic Games\4.7\Engine\Binaries\DotNET\UnrealBuildTool.exe Protato Win64 Development  "C:\Users\Synapse\Desktop\Unreal  Rocks\Protato\Protato.uproject"  -noxge -rocket -NoHotReloadFromIDE. See
MainFrameActions: Packaging (Windows (64-bit)):  logfile for details: 'UnrealBuildTool.txt' 
MainFrameActions: Packaging (Windows (64-bit)): ProcessManager.KillAll: Trying to kill 0 spawned processes.
MainFrameActions: Packaging (Windows (64-bit)): Program.Main: AutomationTool exiting with ExitCode=2
MainFrameActions: Packaging (Windows (64-bit)): Domain_ProcessExit
MainFrameActions: Packaging (Windows (64-bit)): ProcessManager.KillAll: Trying to kill 0 spawned processes.
MainFrameActions: Packaging (Windows (64-bit)): copying UAT log files...
MainFrameActions: Packaging (Windows (64-bit)): RunUAT.bat ERROR: AutomationTool was unable to run successfully.
MainFrameActions: Packaging (Windows (64-bit)): BUILD FAILED

Any advice would be helpful! I have tried poking around and have found nothing that has helped…

Hello VEMI Lab,

It seems like the issue may be related to the Microsoft DirectX SDK. Can you try seeing if the file that it mentions (C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x64\xinput.LIB) exists on your machine? If not, please try installing the SDK which can be found at this link: https://www.microsoft.com/en-us/download/details.aspx?id=6812

If this doesn’t solve your issue, please make a post on our Answerhub website under the Packaging & Deployment section and we will be happy to help you further.

Answerhub: https://answers.unrealengine.com/

Since I cannot find the same question anywhere else, and this is an old post, I thought I’d offer my solution to the LNK1104 fatal error in Visual Studio (while attempting to build the solution): This is occurring when live coding is enabled, the Unreal Editor is currently open, and a C++ compile was already attempted through the editor. The live link seems to override Visual Studio, so the best option is to either save in VS only, then compile in UE–Or, close UE and then build the solution in VS and re-open UE to test the results.