2011年9月13日 星期二

解決重VS2008轉換到VS2010出現 Error: This file requires _WIN32_WINNT to be #defined at least to 0x0403. ....的錯誤


發生原因是代碼定義值是舊版VS訂的
所以只要更換定義值即可

在各專案中,如果標頭檔中有stdafx.h的話
只要在裡面填加

==========================================================================
#ifndef WINVER // 允許使用 Windows 95 與 Windows NT 4 (含) 以後版本的特定功能。
#define WINVER 0x0501 // 將它變更為針對 Windows XP (含) 以後版本適當的值。
#endif

#ifndef _WIN32_WINNT // 允許使用 Windows NT 4 (含) 以後版本的特定功能。
#define _WIN32_WINNT 0x0501 // 將它變更為針對 Windows XP  (含) 以後版本適當的值。
#endif

#ifndef _WIN32_WINDOWS // 允許使用 Windows 98 (含) 以後版本的特定功能。
#define _WIN32_WINDOWS 0x0501 // 將它變更為針對 Windows Me (含) 以後版本適當的值。
#endif

#ifndef _WIN32_IE // 允許使用 IE 4.0 (含) 以後版本的特定功能。
#define _WIN32_IE 0x0601 // 將它變更為針對 IE 5.0 (含) 以後版本適當的值。
#endif
==========================================================================
如果有相同的定義名稱,也可以改定義值即可


by Keng-li.Lin

沒有留言:

張貼留言