Can't compile from Github source metahost.h missing again

Just cleared out my old 4.18 build to put in a 4.2 build and it’s throwing the old

Cannot open include file: ‘metahost.h’: No such file or directory

pretty much the same problem as shown here

but even after explicitly running with -2017 on the generateprojectfiles.bat it’s still throwing that error… the file is in the 8.1 sdk in the um directory… which is part of the search path, but it’s still not seeing it

In my case, it was the VC++ Directories for the UE4 properties causing the problem, they were set to blank by default for some reason, they all need to be set to inherit

Just updated to 4.20.2 and the same thing happened, this time it still won’t compile with inherit set… It’s pointing to the correct SDK directory for it, and it still won’t see the header

I faced the same issue. What I did was to install some missing .NET Framework packages as described in this page:

https://blogs.msdn.microsoft.com/calvin_hsia/2017/02/13/cannot-open-include-file-metahost-h-no-such-file-or-directory/

Then I regenerate the solution with GenerateProjectFiles.bat -2017

After that, the compilation completed without issues and I was able to open the Editor

If someone else runs into this now - I got this error compiling Unreal Engine, version 4.22.1 from github release branch, on a fresh computer with only Visual Studio 2019 installed.

It was resolved by adding “.NET Framework 4.6.2 SDK” as an Individual component to the Visual Studio install, as indicated above.

This is what fixed it for me as well, thanks.

Confirmed for fresh computer with only Visual Studio 2019 installed. Actually in that case one won’t even be able to run GenerateProjectFiles.bat without installing .Net Framework 4.6.2 Target (i.e. Runtime) first.

Notice if project file was generated before installing .Net Framework 4.6.2 SDK, then one needs to regenerate the project file by running GenerateProjectFiles.bat.

Also regenerating project file will require re-compilation of whole solution.

Ditto! Thanks.

For me too! Ive spent 2 days to fix it, bui it still dont work!

Resolved. Should use 4.6.2 SDK ONLY. I tried to use 4.7.2 and 4.8 and had a problem. But it`s hardcoded inside of UE unrealbuildtool Engine\Source\Programs\UnrealBuildTool\Platform\Windows\UEBuildWindows.cs
“TryReadInstallDirRegistryKey32(“Microsoft\Microsoft SDKs\NETFXSDK\4.6.2”, “KitsInstallationFolder”, out OutInstallDir);”
So, in next versions of UE maybe SDK version will change to another. Check it by yourself.

Too bad it’s impossible to check if correct version of .Net SDK is installed instead of failing build with criptic error.

Same problem with my Windows 7, Visual Studio 2017, and UE4 2.24.3.

Installing .NET Framework 4.6.2 SDK did the trick!