2012-03-08 2 views
0

#define _WINSOCKAPI_이 추가되었지만 여전히 빌드가 실패합니다.빌드 실패 : winsock2.h 파일을 찾을 수 없음

/* 
* $PostgreSQL: pgsql/src/include/port/win32/sys/socket.h,v 1.7 2006/10/04 00:30:10 momjian Exp $ 
*/ 
#ifndef WIN32_SYS_SOCKET_H 
#define WIN32_SYS_SOCKET_H 

/* 
* Unfortunately, <wingdi.h> of VC++ also defines ERROR. 
* To avoid the conflict, we include <windows.h> here and undefine ERROR 
* immediately. 
* 
* Note: Don't include <wingdi.h> directly. It causes compile errors. 
*/ 
#define _WINSOCKAPI_ //added this line but no help 
#include <winsock2.h> 
#include <ws2tcpip.h> 
#include <windows.h> 

#undef ERROR 
#undef small 

/* Restore old ERROR value */ 
#ifdef PGERROR 
#define ERROR PGERROR 
#endif 

/* 
* we can't use the windows gai_strerror{AW} functions because 
* they are defined inline in the MS header files. So we'll use our 
* own 
*/ 
#undef gai_strerror 

#endif /* WIN32_SYS_SOCKET_H */ 

답변

0

보십시오.

+0

위의 진술은 어디에 써야합니까? – Ava

1

Windows가 아닌 플랫폼에서 Windows 관련 헤더 파일을 컴파일하려고합니다. 나는 당신이 기대하는 바를 상상할 수 없습니다. 그것이 무엇이든간에, 그것은 그렇지 않습니다.

#ifndef __APPLE__ ... #endif

그런 다음, 다른 하나는 컴파일 오류도 BSD 소켓에서 작동 사과 특정 소켓 파일을 포함 체크 아웃 사용

+0

기존 프로젝트를 가져 오려고합니다. – Ava

+2

그래서 파일을 밖으로 나가십시오. 또한 : 프로젝트가 PostgreSQL 인 경우 XCode가 아닌 명령 줄에서 빌드하려고합니다. – duskwuff

관련 문제