Share via

How do I fix this issue "C1083 Cannot open include file: 'winsock2.h': No such file or directory"

Srikar Veeramallu 0 Reputation points
2023-12-08T13:28:44.68+00:00

I see below errors while compiling a project recently. This used to work absolutely fine few days back.

The include directories value in VC++ directories is $(VC_IncludePath)

$(WindowsSDK_IncludePath) which is evaluated to

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include

C:\Program Files (x86)\Windows Kits\10\Include\10.0.10150.0\ucrt

C:\Program Files (x86)\Windows Kits\8.1\Include\um

C:\Program Files (x86)\Windows Kits\8.1\Include\shared

C:\Program Files (x86)\Windows Kits\8.1\Include\winrt

I see the missing header files in the above directories but the build is unable to find them

The build works fine if I add $(VC_IncludePath) $(WindowsSDK_IncludePath) to C/C++/general/additional Include directories.

Build is somehow not able to take include directories from the vc++ directories

Another observation is that intellisense is able to open these header files but the build is not able to.

How can I troubleshoot this furtherUser's image

Developer technologies | C++
Developer technologies | C++

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.

Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other

A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.


1 answer

Sort by: Most helpful
  1. RLWA32 52,566 Reputation points
    2023-12-11T08:56:26.6033333+00:00

    @Srikar Veeramallu, Without seeing your actual project my best guess is that you have inadvertently changed an important project property. However, since a newly created project does not exhibit the same problems you can add your existing source code to a newly created project which should resolve your issue.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.