Error LNK1181: cannot open input file 'Half.lib'

I’ve been stuck for the last two weeks with this error :
error LNK1181: cannot open input file ‘Half.lib’

I believe the error has been introduced in the [adding OpenEXR library] 8 Aug 2014 4:06 commit. I didn’t find any specific information regarding this error and Unreal Engine. I’m guessing I need something to compile the OpenEXR library, but I’m not sure how to follow the OpenEXR build doc in regards to the Unreal Engine project configuration. Am I missing files or is this a project configuration problem ?

Thanks.

I am also experiencing this problem

After 3 weeks of being stuck I got kind of tired of messing around with it and I went ahead and downloaded the 4.4 version from the launcher instead of using the master branch, obviously it worked but I wanted to avoid having multitude of versions installed on my PC. It seems in the 4.4 version, there are a lot less ThirdParty applications included, OpenEXR is not found in the ThirdParty folder. So I’m guessing it may be possible to disable anything OpenEXR related in the project and still being able to compile the engine… I’d still love to know why we get this error and how to solve it.

I figured out my issue, I was trying to build the master git branch.
Switched over to 4.4, problem resolved itself.

It is definitely related to OpenEXR. This appears to be the same kind of problem as the missing libovr64.dll that has been effecting the master branch lately.

OpenEXR is prebuilt in vc7,vc8, and vc9, but the solution hasn’t been updated for VC2013 (vc12 I think).

-----1-----
Recompile Engine/Source/ThirdParty/openexr/OpenEXR-1.7.1/ilmbase-1.0.3/vc/vc9/IlmBase/IlmBase.sln. in 32bit/64bit, static release/debug configurations. ( I am not sure if these should be typical debug/release dlls or static debug/release dlls ) Note that the three ‘Test’ projects aren’t required, and since they puke if there is a space in the directory path you should probably remove them from the project configuration.

-----2-----
open “Engine/source/ThirdParty/openexr/VS2013/OpenEXR-vs2013/OpenEXR-vs2013,sln”.

-----3-----
Edit the 'IlmImf project settings → c/c++ → General → Additional Include Directories"

change the static directory reference for Zlib to a relative path from:

"D:/Perforce/Epic/UE4/Engine/Source/ThirdParty/zlib/zlib-1.2.5/src"

\ to \

…/…/…/…/…/…/…/zlib/zlib-1.2.5/src” — (7x) “…/”

-----4----- Recompile the OpenEXR-vs2013,sln in staticRelease/staticDebug win32/x64

-----5----- Lastly build the UE4 solution

Hopefully this will be fixed in the 4.5 or 4.4.1 release ‘dependencies’ zip files along with the missing Oculus lib directory.

Thank you for your help.

  1. I’ve proceeded and managed to compile llmBase in all configurations (32bit/64bit/release/debug/static release/static debug.
  2. I’ve changed the Include Directories for the llmlmf project.

I couldn’t compile llmlmf, I get this :

error LNK1104: cannot open file '..\..\..\..\..\..\Deploy\lib\Win32\Debug\zlibwapi.lib'

I think there is something different on my end because on your step 3. you wrote “change the reference… from…to…”. The thing is I didn’t even have zlib referenced in the first place. All I had was :

..\..\..\..\IlmImf
..\..\..\..\config.windows
..\..\..\..\..\..\Deploy\include

Even after adding ..\..\..\..\..\..\..\zlib\zlib-1.2.5\src it would not compile. So there is something wrong with the zlib include, however I’m not super familiar with the projects structure so I haven’t figured out how to fix it yet. It seems I don’t have zlibwapi.lib anywhere on my system, I’m guessing I need to compile zlib ?

Thanks !

Some things to remember: This problem is only for the Master branch. OpenEXR isn’t included in the 4.4 branch yet (as of September 2).

I am assuming you are using Visual Studio 2013 -

Sometimes I forget to do things as i’m going back and forth between my github versions on my local box.

Did you run the GenerateProjectFiles.bat when you changed the branch in your local directory?

How old are your Required zip files?

The third party dependencies haven’t changed since mid/early august, but you want to make sure you have the latest external dependencies (check the date on the zips to make sure they aren’t from July)

Now - provided you already did the two things above then make sure you are compiling the right version of the OpenEXR-vs2013 solution.

Are you building the OpenEXR-vs2013 solution as StaticDebug/StaticRelease or Debug/Release?

It works fine if you compile the StaticDebug/StaticRelease.

Note:
It may be easier to edit the project below in Notepad++ or gvim. It has to be changed in a few spots

/Engine/Source/ThirdParty/openexr/OpenEXR-1.7.1/vc/vc8/OpenEXR/IlmImf/IlmImf.vcxproj

Anywhere you see ensure that the zlib directory is:

..\..\..\..\..\..\..\zlib\zlib-1.2.5\Src

Somewhat like MCcicarone’s answer:

  1. Open the Engine\Source\ThirdParty\openexr\VS2012\OpenEXR-vs$(COMIPLER)\OpenEXR-vs$(COMPILER).sln file replacing $(COMPILER) with 2012 or 2013.

  2. Build the solution for StaticDebug or StaticRelease on x64

  3. Close the OpenEXR solution and try compiling UE4 again. You don’t need to modify the include paths.

Thanks again for your help, this fixed the problem.

Your first answer was indeed the correct procedure :

  1. Open the solution "Engine/Source/ThirdParty/openexr/OpenEXR-1.7.1/ilmbase-1.0.3/vc/vc9/IlmBase/IlmBase.sln".

  2. Remove the three ‘Test’ projects from the solution.

  3. Compile the solution with the 32bit/64bit, static release/debug configurations.

  4. Open the solution "Engine/source/ThirdParty/openexr/VS2013/OpenEXR-vs2013/OpenEXR-vs2013.sln".

  5. For each Configuration (staticRelease/staticDebug win32/x64), change the include directories ('IlmImf project settings → c/c++ → General → Additional Include Directories") for the zlib lib from "D:/Perforce/Epic/UE4/Engine/Source/ThirdParty/zlib/zlib-1.2.5/src" to "../../../../../../../zlib/zlib-1.2.5/src".

  6. Recompile the OpenEXR-vs2013.sln in staticRelease/staticDebug win32/x64.

  7. Build the UE4 solution.

Explanations : When looking in the project file with notepad++, I found two instances where the include directories were indeed "D:/Perforce/Epic/UE4/Engine/Source/ThirdParty/zlib/zlib-1.2.5/src" instead of "..\..\..\..\..\..\..\zlib\zlib-1.2.5\Src". So I looked around those areas and found that they were in a x64 section. That’s when I face palmed and realized the include directories were Configuration dependent, and I didn’t change those paths for the Static Configurations, only for the default Debug Configuration.

I will mark your answer as the correct one, however I still can’t compile the solution. Now I have an error about Oculus. I’ve had this error before, but I managed to solve it by downloading a zip file somebody provided on answerhub. I think something has changed again.

I knew that working with the master branch wasn’t ideal, but I had to use it since I downloaded a map from someone who made it with the master branch version, and if you try to open a map that is made with a more recent version of the editor than what you have, you get an error message stating that you just can’t, and you need to use a newer version of the editor… I tried looking for solutions to bypass that issue without success, so that’s why I had to use the master branch version. And I thought that maintaining multiple versions of the editor would be a pain (official releases + master), so I thought I’d be able to use mainly the master branch (I wouldn’t mind if some parts of the editor would become unstable once in a while, but not being able to compile the solution is a bigger issue imo).

Edit : I followed smilingrob’s advise in this post Compile error with latest 4.4 branch from github - Programming & Scripting - Epic Developer Community Forums and copied the Lib folder from the zip file to the UnrealEngine\Engine\Source\ThirdParty\Oculus\LibOVR\LibOVR_04\Lib folder and now I can compile the engine.