How to use libraries compiled with MingW in MSVC?

Based on this error you put in a comment:

error LNK2019: unresolved external
symbol “int __cdecl
openssl_call(struct ssl_State
*,int,int,int)” (?openssl_call@@YAHPAUssl_State@@HHH@Z)
referenced in function _main MyAPP.obj
all other 4 errors are same only with
other functions names

Try putting extern "C" around your include files for openssl. For example:

extern "C" {
include "openssl.h"
}

using extern “C” will instruct the compiler that the functions are using C linkage, not C++, which will stop it from performing name mangling on the functions. So it will look for the function openssl_call in the library rather than ?openssl_call@@YAHPAUssl_State@@HHH@.

Leave a Comment