Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2013: fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory

I migrated some "native" c++ projects from Visual Studio 2010 on Windows 7 to Visual Studio 2013 on Windows 8.1. Rebuilding gave me this error. I realized I did not have the Windows SDK installed, so I installed that next, but I'm still getting the error. Anyone else get this on otherwise-clean VS project migrations?

like image 698
moodboom Avatar asked Nov 01 '13 21:11

moodboom


2 Answers

I searched under the SDK folder for the missing file and found it. Because the SDK was installed after I migrated the projects, the paths were not included in my projects. I was able to fix everything by adding to my include and lib paths.

I added the following folders to my include paths:

$(WindowsSdkDir)include\um

$(WindowsSdkDir)include\shared

My full include path for both Debug and Release now looks like this:

$(WindowsSdkDir)include;$(WindowsSdkDir)include\um;$(WindowsSdkDir)include\shared;$(FrameworkSDKDir)\include;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;

I added the following folder to my lib paths (note that is specific to a 32-bit build! see x64 for 64-bit, and arm for arm builds...):

$(WindowsSdkDir)lib\winv6.3\um\x86

My full lib path looks like this:

$(WindowsSdkDir)lib;$(WindowsSdkDir)lib\winv6.3\um\x86;$(FrameworkSDKDir)\lib;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib

Note that if you have a copy of the original project file, you can also fix the problem by re-migrating it again after the Windows SDK is installed.

like image 104
moodboom Avatar answered Sep 17 '22 20:09

moodboom


include path: $(VC_IncludePath);$(WindowsSDK_IncludePath);

lib paths:$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);

like image 43
leaf Avatar answered Sep 18 '22 20:09

leaf