vs2015沒法解析外部符號__imp__fprintf

使用vs2015編譯ffmpeg的一個小項時,出現了__imp__fprintf和__imp____iob_func 的錯誤,google了一下,有的人 建議下載SDL源碼從新編譯一下,固然這個方案很是不科學。因此又繼續搜,終於有所發現。數組

這是老外的原話:函數

In visual studio 2015, stdin, stderr, stdout are defined as follow :google

#define stdin (__acrt_iob_func(0)) #define stdout (__acrt_iob_func(1)) #define stderr (__acrt_iob_func(2))

But previously, they were defined as:spa

#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.code

To solve the issue, you can try defining __iob_func() yourself which should return an array containing {*stdin,*stdout,*stderr}.blog

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和之前的定義得不同,因此報錯。it

解決方法呢,就是使用{*stdin,*stdout,*stderr}數組本身定義__iob_func()io

其實就是下邊這樣。編譯

extern "C" { FILE __iob_func[3] = { *stdin,*stdout,*stderr }; }

而後__imp__fprintf的解決方法就是在連接器輸入lib里加上legacy_stdio_definitions.lib這個LIB

 

原文:http://www.letg.top/?p=34

相關文章
相關標籤/搜索