LNK1181 cannot build from source

Hy,

I am trying to build UE4 from source and I have followed the provided instructions from the main website.

For a long time I could not get further than the ‘windows.h’ missing file issue even though the Win SDK and VS15 is all installed as prompted. Environment Variables, check. Firewall Check, Admin rights on every file and program, check.
Also included the libraries in the Source files in VS. Tried the inherit from parent as well even though building from source seemed not even making any sense. Tried to build manually from CMD(Admin).

So I though I ll try a bit of a hack around solution. I started to copy the missing files to a file location that was prompted by default by the generated VS project. This way I got further. It is not missing the “windows.h” or any other from the “Include” folder. However now the “rpcrt4.lib” is missing, even though I have copied it into locations where it can be reached.

the error messages by both CMD and VS:
2>LINK : fatal error LNK1181: cannot open input file ‘rpcrt4.lib’
2>ERROR : UBT error : Failed to produce item: d:\Git Clones\UNREAL SOURCE\UnrealEngine\Engine\Binaries\Win64\UnrealHeaderTool-Core.dll

I am really desparate, please give me some advice.

Hello

Thank you for being detailed in explaining what you’ve already tried. Firstly, when looking this up, it seems that some people running into this are building for the wrong configuration. Can you ensure that you’re building for Development Editor (not to be confused with simply “Development”) when building the source?

Can you provide the full output log from when this occurs?

What version of Visual Studio are you using, as in Express, Community, Enterprise, or Professional? Also, what version of Windows?

Have you successfully built anything else related to Unreal, such as any previous versions of the editor or any code projects when using the Binary engine?

Hy Matthew,

Thank you for your fast reply!

I am building for Development Editor in Visual Studio Community on Windows 10.

No other script or project could build, I always faced the “windows.h” issue.

In the meantime I got it to work with using the Rebuild.bat with the following commands : UE4Editor Win64 Development. in CMD Admin.
however this doesnt solve building from VS. only VS skippes the up to date builds, but if I would want to rebuild from VS I would face the same issues.

the full output log is what I wrote except for a permission issue on the Build.
I manually set to Allow every permission on every member of this machine under the Git Clone, but that did not help. (in case you wonder there is no special character in the login name, ive read on other threads that it could be a problem too).

Inside of Visual Studio, can you try right-clicking on UnrealBuildTool directly and see if it’ll complete successfully? Even if the output log is mainly just saying what modules are being built, it would still be helpful to see the whole thing. Attaching it as a text file would be useful.

Can you also check for something in your Visual Studio installation? Please navigate to the Control Panel > Programs and Features > Microsoft Visual Studio > Change > Modify and check to ensure that “Common Tools for Visual C++ 2015” under “Visual C++” is installed. This is not to be confused with “Common Tools” which is further down the list.

I am attaching the output log with the errors.

About the UnrealBuildTool, it compiles perfectly when I try rebuilding, however building it only tells me that its up to date, seems ok.

I was sure that I had the Common Tools for Visual C++, but just to be sure I did a whole reinstall of VS on the Administrator account ( enabled through CMD ). Because even though I was admin, still didnt have full rights, but this didnt help either.
link text

Just reinstalling won’t guarantee that this part of Visual Studio is installed, as it is not enabled by default. Instead of reinstalling, you’ll need to modify the installation as I mentioned.

When you go to build in the editor, what option are you hitting in particular in Visual Studio? Please keep in mind that unless you specifically tell Visual Studio to compile the UE4 module, it’ll begin building every module in the entire solution. This could include things that you don’t have the prerequisites for, such as the Simplygon bit that it’s failing on in the output log you mentioned, as it seems that you may be missing something that Simplygon requires.

Can you try right-clicking on UE4 in the solution explorer and selecting “Build” on that directly? This should result in building UE4 and only its dependencies.

I am sorry for the inaccurate answer.

First of all, I have always known that I had to tick the install component for VS and so I did again.
I am always only rightclick building the UE4, except when you told me to build the UnrealBuildTool separately.
I only had the chance to test again building UE4 after rebuilding the UnrealBuildTool, and now it seems to compile allright except for the Simpleton errors that appear even by only building the UE4.

I am trying to use source version to be able to access the ES 3.1 feature for Android development.
Following the instructions of a tutorial. I have built the Development Editor Win64, then the Development Win64, resulting in errors only regarding Simplygon.
However when building for Android I am getting the same rpcrt4.lib missing error.link text
The tutorial instructed me to change the BaseEngine.ini and include the line bBuildOpenGLES31=true. Could that be the problem , because by default it wasn’t present only the deferred one and the ES2.
I will include the output txt when I reach my laptop.

Edit: Attaching output log

I would suggest reverting any changes you’ve made to accommodate this Android setup in the interest of making sure we can get the default setup working correctly first.

I noticed that you’re mentioning that you’re building for Win32. Please note, while we do support outputting to Win32 and Android, the editor shouldn’t be built for these platforms and should be built in Win64 in all situations.

Once the editor is built, you can build any of your projects for these configurations to prepare them for packaging but the editor will stay built for the Win64 platform.

I mentioned the Win32, because that popped up by default when I tried to build it for Android. I reverted those back. It seems like that I still cannot always build successfully my editor, not even on Win64.

When I was trying to build the Editor first, the Development Editor UE4, I was using Win64, that you can also see in the Log files I attached.

I agree, first of all the UE4 should be able to build on Win64 successfully in any case. However now I am back to square one with that .lib not opening error.
I am building right now, if you think it would help I can share the latest output log, however it shows the same error.

Please note that this whole issue was present way before I installed the Simplygon SDK on my machine. But if you think it makes sense, I can re clone the whole Git Hub Unreal Source. But I believe the problem was present way before. I got similar errors at the time I was trying to create a CPP class, or even to open a CPP clean project, just didnt compile. Giving the error of ‘windows.h’ could not be loaded.
link text

That doesn’t exactly mean that what you have done has fixed the ‘windows.h’ problem you’re having. You’re likely just running into this other error before the one that would mention not being able to load ‘windows.h’. It would be best to fix the root problem than make further edits and possibly create more issues.

If you do mean to include Simplygon, have you followed the steps listed here?: https://www.simplygon.com/knowledge-base/documentation/unreal-engine-4-integration/standard-integration/getting-started

As far as the ‘windows.h’ error goes, the only thing I can think of off the top of my head that you haven’t mentioned that you have tried would be to check if your windows user name has any special characters in it that may cause issues with compiling due to not being able to read the file paths.

im sorry again, I did write that down as well, but my browser crashed and I rewrote the question. So yes I know about the possible issues with special characters. My username is simply admin, but I also have unlocked the “real”, hidden administrator account in Win10, I experience the same issue in VS logging in there.

I believe there is nothing to find online that I havent read already. I ve spent 40+ hours on this issue… maybe I should just give up…

I have a suspicion though, that the real problem relies somewhere in the Env. Variables, the Include and the Lib configuration. I have tried what one of the forums mention, saying use “inherit from parent”, but it only seems to make sense if the parent if configured right. Do you have a clear list of the fundamental Environmental Variables, correctly stated, and how the include and lib should be configured? I mean it seems that whatever I give in the solution config or the UE4 prop., does not have the right effect.
So when I checked the Solution>Properties>Debug Source Files> There I found several folders by default. Adding the Windows Kit/10…etc. did not seem to do anything. but copying the windows.h itself to one of the folders already there worked till the rpcrt4.lib. but again… I agree that this is a clearly ugly approach, but believe me I tried the clean approach too, and gave up at least 5 times.

by the way I really do appreciate you taking your time and trying to help me!!

All that should be required for Environment Variables are:

VS140COMNTOOLS - C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\

windir - %SystemRoot%

Path - C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit;C:\android-sdk-windows\tools

These are all listed under System Variables. Path will have multiple entries but those should be the only important ones for UE4. Ensure that these match up to your actual file paths as well, in case they are installed elsewhere.

As for the Include and Lib configuration, I’ve never had to do that so I’m not exactly sure, but you should be able to include the following in the Include Directories:

$(VC_IncludePath);$(WindowsSDK_IncludePath);

they are all set as you mentioned

the only thing I can think of as a difference, is that the windows.h and the .lib file are both only existing in the Windows Kit/10/xx.xx.xx.xx/Include/um; Windows Kit/10/xx.xx.xx.xx/Lib/um .
But I also tried to complie with the same setup before I put the WinSDK10, at the time I only had the 8.1

That actually makes me wonder. It seems that the SDKs install differently based off what version of Windows you’re using. Is it possible that your 8.1 SDK and/or Visual Studio were installed from before you upgraded from a previous version to Windows 10? If so, could you try reinstalling the SDKs?

Also, your Path variable may need to be set up for the Win 10 SDK instead, since the windows.h file is present in the Windows 10 SDK when installed on a Windows 10 machine. I’m working on a Windows 7 machine so mine seem to be different.

VS might have been present in my win8, however I have already reinstalled everything. VS at least twice, both SDK versions several times. I have both of the 8.1 and 10 in my Path variable, maybe that confused things up, now I left the 10 only, gonna test it soon, and let you know.

unfortunately I get the same error with only the 10 var in.

I think as a last resort, I am going to try the whole thing on my desktop PC, maybe building the Editor there and using it on my Laptop, not the best solution, because probably I would have to compile there every CPP script I might write :stuck_out_tongue:

Okay this is really … a relief. I fixed the issue. Found on one of the forums that deep uninstalling VS could solve this issue. So for the ones that might suffer from the same problems what I did the was the following:

  1. Get your full admin secret win account unlocked : How to Enable Windows 10 Admin to Remove User Account Control Popups « Windows Tips :: Gadget Hacks
  2. Use the automatic Uninstaller Tool : Uninstall Visual Studio 2015 | Microsoft Docs
  3. reinstall VS 2015 with the including the Common Tools for Visual Studio 2015
  4. Try build.
  5. take a well deserved beer!

However this still doesnt solve the OpenGLES3.1 issue, why I started the whole building from Source thing:)
I ve read somewhere that I have to change in the BaseEngine.ini and set the bBuildForES31 to true. It doesnt have the bBuildForES31 by default but putting it in doesn not make it happen, any ideas where to look?