简体   繁体   中英

Error : MFC requires use of Winsock2.h after migrating Visual C++ project to Visual Studio 2013

After migrating a project from Visual C++ to Visual Studio 2013 I receive the following error on building the project:

C1189:#error: MFC requires use of Winsock2.h

In stdafx.h I've included the following headers:

#include <afxwin.h> 
#include <afxext.h>
#include <afxdtctl.h>
#include <afxcmn.h>
#include <afxsock.h>
#include <WinSock2.h>

I've tried to change the order of the include files ( winsock before and after MFC headers ) but still the same errors.

Can anyone give me some ideas to solve this issues ? Thank you !

Solved ! One of the .cpp files from Extern dependencies was including <winsock.h> . I've removed the include line and the problem was solved. Thank you !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM