WinSock.h has already been included

Issue:

编译一个InDesign CS6 Plug-in,用到boost时遇到如下编译错误:

WinSock.h has already been included

 

原因是Windows 有WinSock.h和WinSock2.h两个版本,windows.h默认include的是WinSock.h。而InDesign CS6 SDK 里用的1.44版本的boost要求WinSock2.h.

 

Solution:

1. 在一般的C++ project 中可以通过定义宏 WIN32_LEAN_AND_MEAN 来解决,或者在#include <windows.h>之前加入#include <winsock2.h>.

2. 在InDesign Plug-in开发中,可在VCPlugInHeaders.h中 #include "ShukHeaders.cp" 之前加入#include "Winsock2.h"。

你可能感兴趣的:(include)