vs2015无法解析外部符号__imp__fprintf 以及imp_iob_func错误
2017-08-02 15:23
597 查看
使用vs2015编译ffmpeg的一个程序时,出现了__imp__fprintf和__imp____iob_func 的错误,以下是官方的回答:
In visual studio 2015, stdin, stderr, stdout are defined as follow :
But previously, they were defined as:
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中和以前的vs版本的定义不同,所以报错。__imp____iob_func 解决方法:
使用{*stdin,*stdout,*stderr}数组自己定义__iob_func(),如下写法:
对于__imp__fprintf的解决方法:
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中和以前的vs版本的定义不同,所以报错。__imp____iob_func 解决方法:
使用{*stdin,*stdout,*stderr}数组自己定义__iob_func(),如下写法:
extern "C" { FILE __iob_func[3] = {*stdin,*stdout,*stderr }; }
对于__imp__fprintf的解决方法:
#pragma comment(lib, "legacy_stdio_definitions.lib")
相关文章推荐
- vs2015无法解析外部符号__imp__fprintf __imp____iob_func
- [解决方案]vs2015无法解析外部符号__imp__fprintf和__imp____iob_func
- VS2015下解决:无法解析的外部符号 __imp___vsnprintf 及__iob_func
- VS2015下解决:无法解析的外部符号 __imp___vsnprintf 及__iob_func
- vs2015无法解析外部符号_imp_fprintf的问题
- vs2015无法解析外部符号__imp__fprintf
- VS2015下解决:无法解析的外部符号 __imp___vsnprintf 及__iob_func
- vs2015无法解析外部符号__imp__fprintf
- VS2015下解决:error LNK2019: 无法解析的外部符号 __iob_func
- vs2015打开VS2010的工程时,无法解析的外部符号 __imp___vsnprintf
- VS2015下解决:error LNK2019: 无法解析的外部符号 __iob_func
- VS2015下解决:error LNK2019: 无法解析的外部符号 __iob_func解决方案
- vs2015打开VS2010的工程时,无法解析的外部符号 __imp___vsnprintf(转载)
- vs2015无法解析的外部符号 __imp___vsnprintf
- VS2015下解决:error LNK2019: 无法解析的外部符号 __iob_func
- VS2015下解决:无法解析的外部符号 __imp___vsnprintf
- vs2015打开vs2010时提示无法解析的外部符号 __imp___vsnprintf
- DirectX在VS2015上编译时遇到“无法解析的外部符号 __vsnwprintf”的解决方法及原因
- vs项目属性中的包含目录和库目录以及附加依赖项全都配置正确了,却还是提示:无法解析的外部符号
- VS2015调用低版本lib库出现“无法解析的外部符号 __snprintf ”问题的解决