刚刚在VS2015上跑工程时遇到的可能无法解析外部符号的一类问题:“unresolved external symbol __imp__fprintf and imp__iob_func”
出现这个问题的原因是因为 VS2015 的stdin,stdout,stderr这三个符号定义和原来版本不同,在VS2015版本
为:
#define stdin (__acrt_iob_func(0))
#define stdout (__acrt_iob_func(1))
#define stderr (__acrt_iob_func(2))
而之前为:
#define stdin (&__iob_func()[0])
#define stdout (&__iob_func()[1])
#define stderr (&__iob_func()[2])
解决办法:
自行定义这三个符号
extern "C" { FILE __iob_func[3] = { *stdin,*stdout,*stderr }; }
参考来源:stackoverflow
另在跑一些老工程时经常出现的找不到动态库的问题,可以按照以下关系自行配置动态库
vc8 = Visual Studio 2005
vc9 = Visual Studio 2008
vc10 = Visual Studio 2010
vc11 = Visual Studio 2012
vc12 = Visual Studio 2013
vc14 = Visual Studio 2015MSVCP80.DLL is from Visual Studio 2005
MSVCP90.DLL is from Visual Studio 2008
MSVCP100.DLL is from Visual Studio 2010
MSVCP110.DLL is from Visual Studio 2012
MSVCP120.DLL is from Visual Studio 2013
MSVCP140.DLL is from Visual Studio 2015