Recently, the code of the new face detection algorithm always prompts WinSock. h has already been included. Someone has provided a solution and reprinted it to remember it.
When you start to use the boost: asio library, the following error occurs during compilation:
Fatal error C1189: # error: WinSock. h has already been pinned DED
Check the boost code that throws this error. It was originally defined as _ WINSOCKAPI _, but not _ WINSOCK2API _
Where do we define _ WINSOCKAPI?
Later, I checked it on the Internet. It turned out that I included the Windows. h header file, and the Windows. h header file included the old WinSock. h file.
It is easy to know the cause. After trying, there are three methods to solve this error:
1. Define the macro WIN32_LEAN_AND_MEAN before Windows. h. (WIN32_LEAN_AND_MEAN indicates that it does not contain materials that are rarely used and biased)
2. Include winsock2.h before Windows. h.
3. Include asio. hpp before Windows. h.
From http://blog.csdn.net/gzlyb/article/details/5870326