错误 LNK2001:VS2017 中未解析的外部符号___iob_func



我正在尝试在VS2017(C++(中编译应用程序,但出现错误:

1>libeay32.lib(cryptlib.obj) : error LNK2001: unresolved external symbol ___iob_func
1>libeay32.lib(pem_lib.obj) : error LNK2001: unresolved external symbol ___iob_func
1>libeay32.lib(ui_openssl.obj) : error LNK2001: unresolved external symbol ___iob_func

报告此类错误的其他帖子适用于VS2015,并参考stdin, stdoutstderr。但是这些修复程序对我不起作用。

奇怪的是,如果我在代码中转到stdin并(右键单击(转到定义,它会将我带到Visual Studio 11.0包含目录,而不是VS2017目录。

我的错误在libeay32.lib中,我找不到任何地方的C++来源。

还有其他人遇到过这个问题吗?

我找到了这个解决方案并将这些行添加到我的 VS 17 C++项目中

#define stdin  (__acrt_iob_func(0))
#define stdout (__acrt_iob_func(1))
#define stderr (__acrt_iob_func(2))
FILE _iob[] = { *stdin, *stdout, *stderr };
extern "C" FILE * __cdecl __iob_func(void) { return _iob; }
This worked for me.

最新更新