unesolved external symbol _imp_fprintf referenced in funciton _showerror

 最近调试一个FFplayer 遇到一个问题,编译时总会提示两个问题:

问题一:

 "LNK2019 unresolved external symbol __imp____iob_func reference in function _ShowError”,通过网上查找原来是VS2015 在声明头文件和以前的版本不一样

 如VS2008的声明:

CRTIMP FILE * __cdecl __iob_func(void);

#define stdin (&__iob_func()[0])

#define stdout (&__iob_func()[1])

#define stderr (&__iob_func()[2])

但是VS2015的声明却是这样:

_ACRTIMP_ALT FILE* __cdecl __acrt_iob_func(unsigned);

#define stdin (__acrt_iob_func(0))

#define stdout (__acrt_iob_func(1))

#define stderr (__acrt_iob_func(2))

解决方法:在源码添加这句:extern "C" { FILE __iob_func[3] = { *stdin,*stdout,*stderr }; } 解决问题

问题二 :"unesolved external symbol _imp_fprintf referenced in funciton _showerror"

解决方法: 右键项目--Properties--Configuration--Linker--Input--Additional Dependencies 添加库 legacy_stdio_definitions.lib

 

参考文章:http://stackoverflow.com/questions/30412951/unresolved-external-symbol-imp-fprintf-and-imp-iob-func-sdl2

http://abcode.info/index/show/247851

http://bbs.csdn.net/topics/391839926

posted @ 2016-06-22 16:40  烟雨&任平生  阅读(384)  评论(0)    收藏  举报