[解決方案]vs2015無法解析外部符號__imp__fprintf和__imp____iob_func


轉自: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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM