Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unresolved external symbol __imp____iob_func referenced in function _OpenSSLDie

I am getting below error while migrating my project from VS2008 to VS2015.

21>TFCLd.lib(cryptlib.obj) : warning LNK4217: locally defined symbol _fprintf imported in function _OpenSSLDie
21>TFCLd.lib(rsa_sign.obj) : warning LNK4049: locally defined symbol _fprintf imported
21>TFCLd.lib(cryptlib.obj) : error LNK2019: unresolved external symbol __imp____iob_func referenced in function _OpenSSLDie
21>TFCLd.lib(rsa_sign.obj) : error LNK2001: unresolved external symbol __imp____iob_func

The project builds in VS2008 but with above error in VS2015. May I know what am I missing.

like image 575
user3665224 Avatar asked May 26 '15 05:05

user3665224


2 Answers

Put this in the begin of your class header file or in stdafx.h

FILE _iob[] = { *stdin, *stdout, *stderr }; 
extern "C" FILE * __cdecl __iob_func(void) { return _iob; }
like image 80
Fred Avatar answered Nov 02 '22 12:11

Fred


Have a look at:
http://openssl.6102.n7.nabble.com/Compiling-OpenSSl-Project-with-Visual-Studio-2015-td59416.html

Changing line 310 of the file e_os.h in the openssl root directory from
# if _MSC_VER> =1300
to
# if _MSC_VER> =1300 && _MSC_VER <= 1800
fixes the problem.

The original poster describes the cause of the problem:

In the Visual Studio 2015 the libraries with old names were redesigned

Visual Studio 2015 is referred to as _MSC_VER == 1900.

like image 5
pitseeker Avatar answered Nov 02 '22 12:11

pitseeker