轉自:http://www.cnblogs.com/ubosm/p/5444919.html
使用vs2015編譯ffmpeg的一個小項時,出現了__imp__fprintf和__imp____iob_func 的錯誤,google了一下,有的人 建議下載下傳SDL源碼重新編譯一下,當然這個方案非常不科學。是以又繼續搜,終于有所發現。
這是老外的原話:
In visual studio 2015, stdin, stderr, stdout are defined as follow :
#define stdin (__acrt_iob_func(0))
#define stdout (__acrt_iob_func(1))
#define stderr (__acrt_iob_func(2))
But previously, they were defined as:
#define stdin (&__iob_func()[0])
#define stdout (&__iob_func()[1])
#define stderr (&__iob_func()[2])
So now __iob_func is not defined anymore which leads to a link error when using a .lib file compiled with previous versions of visual studio.
To solve the issue, you can try defining
__iob_func()
yourself which should return an array containing
{*stdin,*stdout,*stderr}
.
Regarding the other link errors about stdio functions (in my case it was
sprintf()
), you can add legacy_stdio_definitions.lib to your linker options.
答題意思就是stdin, stderr, stdout 這幾個函數vs2015和以前的定義得不一樣,是以報錯。
解決方法呢,就是使用{*stdin,*stdout,*stderr}數組自己定義__iob_func()
其實就是下邊這樣。
extern "C" { FILE __iob_func[3] = { *stdin,*stdout,*stderr }; }
然後__imp__fprintf的解決方法就是在連結器輸入lib裡加上legacy_stdio_definitions.lib這個LIB