Can't include Winsock2.h in MSVC 2010

后端 未结 2 1419
夕颜
夕颜 2021-01-04 08:01

I cannot include WinSock2.h in a msvc++2010 project. At first I though it was something I was doing wrong, so I created an empty project to test my sanity. The empty project

2条回答
  •  情歌与酒
    2021-01-04 08:22

    I made sure that an #include "Winsock2.h" is before any #include "windows.h" and "#include "Winsock.h" and this solved the case.

    Just a matter of patience, look at includes one by one and establish this order, first #include "Winsock2.h" then #include "windows.h"

    I checked the recursive includes, I spotted the header files which include (recursively) some #include "windows.h" and "#include "Winsock.h"and write a#include "Winsock2.h". in this files, i added#include "Winsock2.h"` as the first include.

提交回复
热议问题