views:

250

answers:

2

I installed the openssl 0.9.8l and added the include and library paths to the VS directories. (I have done this before when installing boost libraries). But i continue to get linker errors.

Anyway i can resolve the same.

errors are as follows

Error   1   error LNK2019: unresolved external symbol _BN_free referenced in function _main RSA.obj RSA
Error   2   error LNK2019: unresolved external symbol _BN_bn2dec referenced in function _main   RSA.obj RSA
Error   3   error LNK2019: unresolved external symbol _BN_num_bits referenced in function _main RSA.obj RSA
Error   4   error LNK2019: unresolved external symbol _BN_generate_prime referenced in function _main   RSA.obj RSA
Error   5   error LNK2019: unresolved external symbol _BN_new referenced in function _main  RSA.obj RSA
Error   6   fatal error LNK1120: 5 unresolved externals C:\Visual Studio 2008\Projects\RSA\Debug\RSA.exe    RSA
A: 

You also need to specify the library names as "additional dependencies".

In Project | Properties, you need to go to Linker | Input. In Additional Dependencies, you need to provide the names of the libraries.

Update

You want to link in libeay32.lib and ssleay32.lib.

You may have multiple versions called libeayMT.lib or libeayMDd.lib. These are built against different versions of the runtime library and you want to pick the one that matches how you are building your program. You can find this also in the Properties dialog in C/C++ | Code Generation | Runtime Library.

R Samuel Klatchko
thanks, i did that, but now i get thisError 1 fatal error LNK1104: cannot open file 'C:\OpenSSL.obj' RSA RSAthere is no OpenSSL.obj at this location.
Techeretic
The file will be a .lib, not a .obj file. Look in the library path you added to see what the name of the file is.
R Samuel Klatchko
i have no idea what library do i mention.i'm still getting this errorError 1 error LNK2001: unresolved external symbol _BN_free RSA.obj RSAError 2 error LNK2001: unresolved external symbol _BN_num_bits RSA.obj RSAError 3 error LNK2001: unresolved external symbol _BN_bn2dec RSA.obj RSAError 4 error LNK2001: unresolved external symbol _BN_new RSA.obj RSAError 5 error LNK2001: unresolved external symbol _BN_generate_prime RSA.obj RSAError 6 fatal error LNK1120: 5 unresolved externals just that the linker error has changed to LNK2001 from LNK2019
Techeretic
there are many .lib files here, am trying to look up in the openssl documentation for any help but no luck so far
Techeretic
i'm sorry man, still giving me the linker errors, found as to whether to use MD or MT, added those libs to the 'additional dependencies' but still keep on getting the linker error.......really appreciate all your help dude!
Techeretic
A: 

Hi Techeretic,

OpenSSL defaults to Multithreaded DLL (/MD). Just like what Klatchko said before, you should first set your Runtime Library to /MD and add corresponding libeay32MD.lib and ssleay32MD.lib (they are in \Microsoft Visual Studio 9.0\VC\lib on my computer) to Additional Dependencies under Linker | Input. (Make sure you copy those .lib files to the right directories first!)

I had the same problem and that's how I fixed it!

BTW, I use the binary version of OpenSSL for windows. You can find it on OpenSSL offical site, under related/binaries.

Cheers!

Z.Zen

Z.Zen