C2008 關於_vsnprintf 的重定義問題
在使用VS2008打開一個2005的firebird工程,進行編譯時,發生一個關於_vsnprintf 的錯誤 c:\program files\microsoft visual studio 9.0\vc\include\stdio.h(358) : error C3163: “_vsnprintf”: 屬性與以前的聲明不一致 c:\program files\microsoft visual studio 9.0\vc\include\stdio.h(350) : 參見“_vsnprintf”的聲明 |
有人說解決辦法是這個:
"VC9 CRT 的 vsnprintf 與其他第3方定義的衝突,導致VS2008 編譯錯誤"
error C3163: '_vsnprintf': attributes inconsistent with previous declaration
比如
wpdpack\include\pcap-stdinc.h
定義了,要註釋掉
//#define vsnprintf _vsnprintf
或
#if _MSC_VER < 1500
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#endif
但是並沒有發現可以解決問題。
有的又說是這個:
沒這麼麻煩!既然PCAP.h包的stdio.h的頭文件有問題,就先把stdio.h包進來。
就這樣:
#include <stdio.h>
#include <pcap.h>
不是頭文件有問題,只是winpcap對系統的stdio.h進行了重定議,兩個版本間出現了一點小小的磨擦.
最後的解決方法
error C3163: “_vsnprintf”: 屬性與以前的聲明不一致
據說是因爲winpcap對系統的stdio.h進行了重定議,兩個版本間出現了一點小小的磨擦,我將WpdPack_4_0_1中的pcap-stdinc.h文件中#define vsnprintf _vsnprintf一句註釋掉,問題就解決了。
以上步驟後,就可以進行編程了