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

相关文章
相关标签/搜索