日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

VS2010编译错误:fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x

發(fā)布時間:2023/12/31 编程问答 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 VS2010编译错误:fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

編譯VTK,MFC時,mfc對版本的要求問題:

解決方法原文鏈接:http://www.cnblogs.com/madhenry/archive/2011/06/29/2093678.html

最近拿到一個別人的工程,是使用VS.net創(chuàng)建的,而我的機器上只有vs2010,于是用自帶的轉(zhuǎn)換工具將它轉(zhuǎn)換成vs2010的工程,轉(zhuǎn)換之前我就很擔心,怕轉(zhuǎn)換完后會出問題,但是沒有辦法,我實在是不想再安一個vs.net了。

? 轉(zhuǎn)完后果不其然真出了問題,在重新build工程時,報了一大堆錯誤,其中第一個就是“fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x0403. Value 0x0501 or higher is recommended”,然后看錯誤的來源,竟然是atlcore.h,這我就無語了,這是mfc自帶的文件,出錯的可能性基本上為0,于是只好去請教谷大叔,發(fā)現(xiàn)很多人都遇到了這個問題,看了幾篇博客和帖子后,大概明白了,應該是_WIN32_WINNT這個宏對應定義的系統(tǒng)的版本號,如果太低的話,編譯器就會認為代碼無法在當前的系統(tǒng)上編譯。

? 說了原因,下面是修改方法,就是在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


后記:編譯解決這個錯誤后,VTK完全編譯成功!mark一下!

總結

以上是生活随笔為你收集整理的VS2010编译错误:fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。