# Build from source fails with errors C4834 and MSB3073

**URL:** <https://forums.unrealengine.com/t/build-from-source-fails-with-errors-c4834-and-msb3073/1266696>\
**Category:** Getting Started & Setup\
**Tags:** unreal-engine, question\
**Created:** [August 20, 2023, 1:50pm UTC](https://forums.unrealengine.com/t/build-from-source-fails-with-errors-c4834-and-msb3073/1266696 "2023-08-20T13:50:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ptitbgdu80](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ptitbgdu80](https://forums.unrealengine.com/u/ptitbgdu80)\
**Post date:** [August 20, 2023, 1:50pm UTC](https://forums.unrealengine.com/t/build-from-source-fails-with-errors-c4834-and-msb3073/1266696/1 "2023-08-20T13:50:41Z")

</div>

Hi everyone,

I’m trying to build the release version (5.2.1) from source in order to use a dedicated server. I carefully followed the readme on the [github repository](https://github.com/EpicGames/UnrealEngine). I installed Microsoft Visual Studio 2022 (on Windows 10 64bits) with the required workloads as explained in the unreal documentation [here](https://docs.unrealengine.com/5.2/en-US/setting-up-visual-studio-development-environment-for-cplusplus-projects-in-unreal-engine/).

I successfully run the Setup.bat and the GenerateProjectFiles.bat files, then opened UE5.sln in Visual Studio, selected Development Editor and Win64, and finally built UE5 from the solution explorer.

The build failed with this message :

```auto
F:\UE\Engine\Plugins\Runtime\Steam\SteamVR\Source\SteamVRInputDevice\Private\SteamVRInputDeviceFunctionLibrary.cpp(513): error C4834: discarding return value of function with 'nodiscard' attribute
F:\MSVS\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command "..\..\Build\BatchFiles\Build.bat -Target="UnrealEditor Win64 Development" -Target="ShaderCompileWorker Win64 Development -Quiet" -WaitMutex -FromMsBuild" exited with code 6.

```

Here is the entire output after trying a new build :

```auto
Build started...
1>------ Build started: Project: EpicGames.UHT, Configuration: Development Any CPU ------
2>------ Build started: Project: UnrealBuildTool, Configuration: Development Any CPU ------
3>------ Build started: Project: UE5, Configuration: Development_Editor x64 ------
3>Using bundled DotNet SDK version: 6.0.302
3>Running UnrealBuildTool: dotnet "..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" -Target="UnrealEditor Win64 Development" -Target="ShaderCompileWorker Win64 Development -Quiet" -WaitMutex -FromMsBuild
3>Log file: F:\UE\Engine\Programs\UnrealBuildTool\Log.txt
3>Building UnrealEditor and ShaderCompileWorker...
3>Using Visual Studio 2022 14.37.32822 toolchain (F:\MSVS\VC\Tools\MSVC\14.37.32822) and Windows 10.0.22621.0 SDK (C:\Program Files (x86)\Windows Kits\10).
3>Determining max actions to execute in parallel (4 physical cores, 8 logical cores)
3> Executing up to 4 processes, one per physical core
3>Building 6 actions with 4 processes...
3>[1/6] WriteMetadata UnrealEditor.version cancelled
3>[2/6] WriteMetadata UnrealEditor.target cancelled
3>[3/6] Link [x64] UnrealEditor-SteamVRInputDevice.lib cancelled
3>[4/6] Link [x64] UnrealEditor-SteamVRInputDevice.dll cancelled
3>[5/6] Link [x64] UnrealEditor-SteamVREditor.dll cancelled
3>[6/6] Compile [x64] Module.SteamVRInputDevice.cpp
3>F:\UE\Engine\Plugins\Runtime\Steam\SteamVR\Source\SteamVRInputDevice\Private\SteamVRInputDeviceFunctionLibrary.cpp(513): error C4834: discarding return value of function with 'nodiscard' attribute
3>F:\MSVS\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command "..\..\Build\BatchFiles\Build.bat -Target="UnrealEditor Win64 Development" -Target="ShaderCompileWorker Win64 Development -Quiet" -WaitMutex -FromMsBuild" exited with code 6.
3>Done building project "UE5.vcxproj" -- FAILED.
========== Build: 2 succeeded, 1 failed, 5 up-to-date, 0 skipped ==========
========== Build started at 14:22 and took 03:09,272 minutes ==========

```

I saw both error codes **C4834** and **MSB3073** , I obviously googled it and found different topic with similar issues [here](https://forums.unrealengine.com/t/build-from-source-error-msb3073/510622/2), [here](https://forums.unrealengine.com/t/solved-error-msb3073-version-4-26/156371/2), and [there](https://forums.unrealengine.com/t/error-msb3073-building-4-26-caused-by-extra-quotation-mark/471123/3).

I tried all the solutions proposed in these topics :

- Deleting various files in Engine\Intermediate
- Use a shorter path for the parent folder (can’t remember where I saw this solution)
- Change quotes position in the command line that fails

None of them changed anything…

Thank you for reading this topic, I hope I’ll find a solution here.

---

<div class="post-metadata">

**Author:** ![Anonymous\_c0b2ef1d8b6296d661f82020eeaf73de](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/anonymous_c0b2ef1d8b6296d661f82020eeaf73de/32/742521_2.png) [@Anonymous\_c0b2ef1d8b6296d661f82020eeaf73de](https://forums.unrealengine.com/u/Anonymous_c0b2ef1d8b6296d661f82020eeaf73de)\
**Post date:** [August 21, 2023, 8:38am UTC](https://forums.unrealengine.com/t/build-from-source-fails-with-errors-c4834-and-msb3073/1266696/2 "2023-08-21T08:38:26Z")

</div>

I met this question too，And I fix it ！  
Delete it directly

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/5/e/55e22218d1e9c019b99486b96dd2935bd3a45500.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/3/8/738dce2b51fadb592da9e94d761155db42e49427.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/6/a/96a2412d7f1c7c71bc1b7808d0371078f7316b98.jpeg)

---

<div class="post-metadata">

**Author:** ![ptitbgdu80](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ptitbgdu80](https://forums.unrealengine.com/u/ptitbgdu80)\
**Post date:** [August 21, 2023, 6:31pm UTC](https://forums.unrealengine.com/t/build-from-source-fails-with-errors-c4834-and-msb3073/1266696/3 "2023-08-21T18:31:15Z")

</div>

Hi @Anonymous_c0b2ef1d8b6296d661f82020eeaf73de ,

Thank you very much for this answer, it works perfectly. I could have found this solution by myself but I didn’t want to modify any line of code for the first compilation…

I also tried to debug the function instead of commenting it. I tried to do

```auto
auto _ = GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, (TEXT("Unable to find Action [%s] for Action Set [%s]"), *ActionName.ToString(), *ActionSet.ToString()));

```

in order to satisfy the nodiscard attribute but auto doesn’t work here. I looked at the return type of this function and it seems to be void so I’m not sure to understand how it can have a void return type and a nodiscard attribute at the same time… Actually I can’t even find where the nodiscard attribute is.

Anyway, thank you very much for your help.

---

<div class="post-metadata">

**Author:** ![alexkondratenko](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@alexkondratenko](https://forums.unrealengine.com/u/alexkondratenko)\
**Post date:** [August 24, 2023, 7:29am UTC](https://forums.unrealengine.com/t/build-from-source-fails-with-errors-c4834-and-msb3073/1266696/4 "2023-08-24T07:29:49Z")

</div>

Hi @ptitbgdu80 and @Anonymous_c0b2ef1d8b6296d661f82020eeaf73de,  
Removing line 513 is not really a solution to the problem.

This is a bug in the UE code on line 513.  
It should probably be:

```auto
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("Unable to find Action [%s] for Action Set [%s]"), *ActionName.ToString(), *ActionSet.ToString()));

```

instead of:

```auto
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, (TEXT("Unable to find Action [%s] for Action Set [%s]"), *ActionName.ToString(), *ActionSet.ToString()));

```

Actually the problem is in the substring:

```auto
(TEXT("Unable to find Action [%s] for Action Set [%s]"), *ActionName.ToString(), *ActionSet.ToString())

```

This line is like:

```auto
const TCHAR *value = (TEXT("some value"), name1.CalculateString(), name2.CalculateString());

```

or

```auto
auto a = (op1(), op2(), op3());

```

the results of calling op1 and op2 will be ignored, but only op3() will be assigned to a.  
So, if op1 or op2 has a “nodiscard” attribute, Visual Studio will generate an error/warning.  
The previous version of Visual Studio did not have this behavior. New Visual Studio update - has.

The actual nodiscard attribute that can cause this error in this situation is UnrealString.h, line 324:

```auto
	/**
	 * Get pointer to the string
	 *
	 * @Return Pointer to Array of TCHAR if Num, otherwise the empty string
	 */
	UE_NODISCARD FORCEINLINE const TCHAR* operator*() const UE_LIFETIMEBOUND
	{
		return Data.Num() ? Data.GetData() : TEXT("");
	}

```

To sum up, the solution would be to use this line instead of line 513:

```auto
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("Unable to find Action [%s] for Action Set [%s]"), *ActionName.ToString(), *ActionSet.ToString()));

```

---

<div class="post-metadata">

**Author:** ![ptitbgdu80](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ptitbgdu80](https://forums.unrealengine.com/u/ptitbgdu80)\
**Post date:** [August 24, 2023, 12:28pm UTC](https://forums.unrealengine.com/t/build-from-source-fails-with-errors-c4834-and-msb3073/1266696/5 "2023-08-24T12:28:04Z")

</div>

Hi @alexkondratenko ,

Thank you for this detailed fix, I didn’t think that the problem could come from the function arguments… Actually we didn’t only remove line 513, but rather the entire function declaration and definition, and I wasn’t too much worried about that since this function is marked UDEPRECATED in the header file.

Maybe I (you ?) should pull this in UE5 git repository?

However, your fix is probably cleaner than the previous one. Thank you!

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [September 23, 2023, 12:28pm UTC](https://forums.unrealengine.com/t/build-from-source-fails-with-errors-c4834-and-msb3073/1266696/6 "2023-09-23T12:28:31Z")

</div>

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