Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error LNK2001: unresolved external symbol ___iob_func in VS2017 [duplicate]

I am tryig to compile an application in VS2017 (C++) and I get the errors:

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

Other posts reported on such an error are for VS2015 and refer to stdin, stdout and stderr. But those fixes have not worked for me.

Strangely, if I go to stdin in the code and (right click) go to definition it takes me to Visual Studio 11.0 include directories, not the VS2017 ones.

My error is in libeay32.lib which I can't find a C++ source for anywhere.

Has anybody else had this problem?

like image 763
Chris H Baker Avatar asked Dec 10 '25 06:12

Chris H Baker


1 Answers

I found this solution and added these lines to my VS 17 C++ project

#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.
like image 181
ari Avatar answered Dec 11 '25 20:12

ari



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!