error C1189以及warning MSB8012

今天在將一個VS2003的工程轉化爲VS2010的時候,出了一些問題。

首先是:

fatal error C1189: #error :  This file requires _WIN32_WINNT to be #defined at least to 0x0403. Value 0x0501 or higher is recommended.

其次是:

warning MSB8012: TargetExt(.exe) 與 Linker 的OutputFile 屬性值(.scr)不匹配。

針對第一個bug的解決方案是找到stdafx.h,添加以下的語句,並且註釋掉類似的。

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

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

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

#ifndef _WIN32_IE // Allow use of featuresspecific to IE 4.0 or later.
#define _WIN32_IE 0x0601 // Change this to theappropriate value to target IE 5.0 or later.
#endif

 

針對第二個bug的原因是linker的輸出文件和目標文件不一致,從而導致不能正常的鏈接程序,這一點我們可以參考任何一個正常的VS2010的工程,觀察期那些目錄的設置,然後把轉換的工程的目錄配置改成和正常工程的目錄配置一樣就可以了。

VS2010中屬性-》配置屬性-》常規


VS2010中屬性-》鏈接-》常規


VS2003中經過VS2010轉化後Release版本的展示,屬性-配置屬性-》常規


VS2003中經過VS2010轉化後Release版本的展示,屬性-》鏈接-》常規


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章