1、无法解析的外部符号 __imp___vsnprintf
出现这个问题的原因是 vs2015 默认编译时将许多标准库采用内联方式处理,因而没有可以链接的标准库文件,所以要专门添加标准库文件来链接标准库中的函数。
- 在 vs2017工程选项,链接器附加依赖项里面添加 legacy_stdio_definitions.lib 即可。
- 在调用的文件中添加:#pragma common(lib, "legacy_stdio_definitions.lib")
2、解决:无法解析的外部符号__iob_func
在使用 VS2017 下使用 levmar及相关静态库,编译时报错了:
error LNK2019: 无法解析的外部符号 __iob_func,该符号在函数 output_message 中被引用。
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 }; }