VS2010 컴파일 오류:fatal error C1189: #error:This file requires _WIN32_WINNT to be #defined at least to 0x0403...해결 방법

2255 단어 require
최근에 다른 사람의 공사를 받았는데 VS.net을 사용해서 만들었습니다. 제 기계에는 vs2010밖에 없습니다. 그래서 자체적으로 가지고 있는 변환 도구로 vs2010의 공사로 변환했습니다. 변환하기 전에 걱정이 많았습니다. 변환이 끝나면 문제가 생길까 봐 걱정했지만 어쩔 수 없습니다. 저는 vs.net을 하나 더 설치하고 싶지 않습니다.
돌이켜보니 정말 문제가 생겼습니다. 다시 빌드 프로젝트를 할 때 많은 오류가 발생했습니다. 그 중 첫 번째는 "fatal error C1189: #error: This file requires _WIN32_WINNT to be #defined atleast to 0x0403. Value 0x0501 or higher is recommended"입니다. 그리고 오류의 출처를 보니atlcore입니다.h, 이건 어이가 없어요. 이것은 mfc가 가지고 있는 파일이에요. 오류 가능성은 기본적으로 0이에요. 그래서 곡 아저씨에게 가르침을 청할 수밖에 없어요. 많은 사람들이 이 문제에 부딪혔어요. 몇 편의 블로그와 게시물을 보고 대충 알았어요. 아마도_WIN32_WINNT라는 매크로가 정의된 시스템의 버전 번호입니다. 너무 낮으면 컴파일러는 코드를 현재 시스템에서 컴파일할 수 없다고 생각합니다.
원인을 말했습니다. 다음은 수정 방법입니다. 바로 stdafx입니다.h 파일에서 관련 정의를 수정하면 수정된 효과는 다음과 같습니다.
#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
#define WINVER 0x0501 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif

#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif

#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0501 // Change this to the appropriate value to target Windows Me or later.
#endif

#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
#define _WIN32_IE 0x0601 // Change this to the appropriate value to target IE 5.0 or later.
#endif

그러면 문제 없을 거예요.
참고 자료:
(1) http://topic.csdn.net/u/20100801/22/2a271d13-b3e9-419b-906c-039c8f3a5e0e.html
(2) http://blog.csdn.net/dongliqiang2006/archive/2010/08/13/5810055.aspx
(3) http://topic.csdn.net/u/20100401/14/c5b852d1-9934-4056-89f5-4a6041fe73de.html

좋은 웹페이지 즐겨찾기