New C++ Project fails to compile using UE 4.15 and VS 2017 Community Edition - LINK : fatal error LNK1181: cannot open input file 'ws2_32.lib'

Running Win10 64 bit

I downloaded and installed VS2017 CE and install options
Desktop Development with C++
.NET Desktop Development
Games Development with C++
Unreal Installer

I then run Epic Games installer, and install UE4.

I then create new Basic Code C++ project, and it fails with the following error.

Running C:/Program Files/Epic Games/UE_4.15/Engine/Binaries/DotNET/UnrealBuildTool.exe MyProject1 Development Win64 -project=“C:/Users/username/Documents/Unreal Projects/MyProject1/MyProject1.uproject” -editorrecompile -progress -NoHotReloadFromIDE
Performing full C++ include scan (building a new target)
Creating makefile for MyProject1 (no existing makefile)
@progress push 5%
Parsing headers for MyProject1Editor
Running UnrealHeaderTool “C:\Users\username\Documents\Unreal Projects\MyProject1\MyProject1.uproject” “C:\Users\username\Documents\Unreal Projects\MyProject1\Intermediate\Build\Win64\MyProject1Editor\Development\MyProject1Editor.uhtmanifest” -LogCmds=“loginit warning, logexit warning, logdatabase error” -Unattended -WarningsAsErrors -installed
Reflection code generated for MyProject1Editor in 3.82364 seconds
@progress pop
Performing 8 actions (4 in parallel)
[2/8] Resource ModuleVersionResource.rc.inl
[3/8] Resource PCLaunch.rc
PCH.MyProject1.cpp
MyProject1.cpp
MyProject1GameModeBase.cpp
MyProject1.generated.cpp
[7/8] Link UE4Editor-MyProject1.dll
[8/8] Link UE4Editor-MyProject1.lib
LINK : fatal error LNK1181: cannot open input file ‘ws2_32.lib’
Creating library C:\Users\username\Documents\Unreal Projects\MyProject1\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MyProject1.lib and object C:\Users\username\Documents\Unreal Projects\MyProject1\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MyProject1.exp
ERROR: UBT ERROR: Failed to produce item: C:\Users\username\Documents\Unreal Projects\MyProject1\Binaries\Win64\UE4Editor-MyProject1.dll
Total build time: 42.00 seconds (Local executor: 0.00 seconds)

I am also having this problem with windows 7. I’ve installed the c++ desktop workload and the game dev workload. I’d like to see this get answered as well:)

Sorry. Meant to add this as a comment :0

Hello anonymoussalt & Straskal,

I’ve seen LNK 1181 errors before but never with this particular file. From what I’ve looked up, it seems related to Windows SDK installations, as with most LNK errors. If you have the Windows 8.1 and/or Windows 10 SDK installed (These are separate SDKs, not updates for one another), please try uninstalling, restarting your computer, and then reinstalling the SDKs. For Straskal, since you’re on Windows 7, you should only need the Windows 8.1 SDK.

For my own installation, the WS2_32.lib file is located in the 8.1 SDK so I would focus on that first, and then worry about the Windows 10 SDK if reinstalling 8.1 doesn’t help. I am on Windows 7 however so it may be different for you, anonymoussalt.

Please give those options a try and let me know the results.

thanks guys - out of desperation I ran this Releases · microsoft/VisualStudioUninstaller · GitHub (it removed a bunch of stuff) and then repaired my VS2017 CE and it fixed it. I suspect old 2013 or 2015 installs confused things.
I am working 100% now.

Woo, thank you this worked for me too!

That’s the real MVP up there! :smiley:
This saved my life thanks mate!

Can confirm this works as of 3/14/2018. Thanks a bunch!

YAY, this helps me too! I have had installed visual Studio 2015 and uninstalled it, because i wanted visual studio 2017. After the “Uninstaller”-Tool i repaired the visual Studio 2017 installation and my ue4 packaging without errors! THANKS!

Thanks dude its fix my problem too.

YES!!! Finally, been on this issue for 2 days straight.
@anonymoussalt diamond geeza, mate :wink:

I love this. I figured nobody would ever read my post. hahaha. makes me happy i could help!

OMG THANK YOU

This was probably my last attempt trying. And it worked ! Thank you!!

Bingo. On one machine, my x64 folder in the sdk had 90 files, but 465 on another. Uninstalled and resinstalled win 10 sdk 10.0…17134 and the files were restored (repair did not do this). So packaging for 64 bit now working.

This works when uninstalling Visual Studio 15 so you can just use newer version

Run the Uninstaller > Repair your Visual Studio 17 > Open Visual Studio from Unreal Engine version to let it rebuild as it thinks its a first time run.

Was able to build the project and run the .exe file with no hiccups.