0
votes

I'm developing on a visual studio 2013 application and therefore I need to include openssl libraries.

What have I done so far:

  • I downloaded the precompiled openssl libraries for VS2013 openssl-1.0.1l-vs2013.7z from here: http://www.npcglib.org/~stathis/blog/precompiled-openssl/ (newest stable entry MSVC2013)

  • included openssl's include dir to C/C++/General/Additional Include Directories

  • added lib64/libeay32MTd.lib and lib64/ssleay32MTd.lib to Linker/Input/Additional Dependencies

  • I call openssl headers this way: #include <openssl\pem.h> (as example)

I am using VS 2013 on a 64 Bit Windows maschine with the multithreading runtime library (/MTd). Every time I want to build my project it gives me the following errors:

error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_BIO_new_mem_buf" in Funktion "__catch$?decrypt@cipherEngine@@QAE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PADH@Z$4".

error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_RSA_private_decrypt" in Funktion "__catch$?decrypt@cipherEngine@@QAE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PADH@Z$4".

error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_PEM_read_bio_RSAPrivateKey" in Funktion "__catch$?decrypt@cipherEngine@@QAE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PADH@Z$4".

error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: class std::basic_string,class std::allocator > __thiscall cipherEngine::rsaPrivateDecrypt(class std::basic_string,class std::allocator >)" (?rsaPrivateDecrypt@cipherEngine@@QAE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V23@@Z)" in Funktion ""public: bool __thiscall cipherEngine::alterKey(class std::basic_string,class std::allocator >)" (?alterKey@cipherEngine@@QAE_NV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)".

fatal error LNK1120: 4 nicht aufgelöste Externe

Anyone who knows the "missing link"?

2
Because German error messages may be difficult to understand for non-German native speakers: Those linker errors are complaining about undefined references to BIO_new_mem_buf, RSA_private_decrypt, PEM_read_bio_RSAPrivateKey, and cipherEngine::rsaPrivateDecrypt.Wintermute
You appear to be missing the crypto module from your link line. I've not done it on windows, but if the naming scheme is anything indication, the library would be something like: lib64/crypto32MTd.libWhozCraig

2 Answers

0
votes

When adding external libraries to VS I usually try to include the library source and build them within my own tree. This avoids the problem I think you are seeing, which is that the precompiled library has been compiled with slightly different options than your main project. The different options render the library unusable to you.

If you really don't want to compile the lib within your project, try investigating those symbols further to identify the compile variant.

0
votes

I forgot to define the class, the function rsaPrivateDecrypt belongs to (shame on me). The second thing was to use the 32Bit libs instead of the 64Bit libs.