C++ – Can’t add static lib

cdlllinkeropensslstatic-libraries

I am trying to build a DLL and it needs to reference a library namely libeay32.dll from the openssl package. I cant seem to add it as a reference under the Property Pages->Common Properties->Add New Reference because it gives error "Could not add a reference to file 'C:\OpenSSL\libeay32.dll' because it is neither a .NET assembly or registered Active X Control. I can compile and run it when I use the Linker->Input->Additional Dependencies and set the static lib 'C:\OpenSSL\lib\libeay32.lib'. But the end result is I need to include the libeay32.dll also. What am I doing wrong?

Best Answer

You're doing everything correctly. "Add Reference" is for .NET assemblies (and COM components used via .NET COM interop). The second approach that you've tried is the correct way to do this for native code, but libeay32.lib is not a static library; it's an export library for the DLL.