0

I want to use cryptopp.lib in my sln. In C/C++ -> General -> Additional Include Directories I add path to dir crypto "...\crypto 850" In VC++ Directories -> Library Directories I add path to cryptopp.lib "...\cryptoop 850\x64\DLL_Output\Debug" In Linker -> Input -> Additional dependencies I add cryptopp.lib But I still get errors:enter image description here

How can I fix them, what should I do?

SMax23
  • 11
  • 2
  • Do you have a hard requirement that users of your project be able to use their own version of cryptopp?. If not, you should link against the static library, not the dll. –  Jun 02 '21 at 13:26
  • Where I use link for DLL? I use link fot static(cryptopp.lib) – SMax23 Jun 02 '21 at 13:34
  • The way dynamic libraries work on windows, you still "statically" link against a `.lib`, but that's just a shim/placeholder. "cryptoop 850\x64\ **DLL** _Output\Debug" is a bit of a dead giveaway that this is what you are doing. –  Jun 02 '21 at 13:36
  • But I want just static lib,where I can get IT?I download from https://www.cryptopp.com/release850.html and build cryptdll project?What I do wrong? – SMax23 Jun 02 '21 at 13:44
  • Have you considered building the project that has the same name but without `dll`? –  Jun 02 '21 at 13:45
  • How should I do it? – SMax23 Jun 02 '21 at 13:47
  • Just build `cryptlib.vcxproj` instead of `cryptlibdll.vcxproj`. –  Jun 02 '21 at 13:49
  • Ok, I already build cryptlib and want to use it, but I have different error,then I building my sln: Error LNK2038 mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in Application.obj CplusplusTest C:\...\CplusplusTest\cryptlib.lib(adler32.obj) – SMax23 Jun 02 '21 at 13:52
  • https://stackoverflow.com/questions/14714877/mismatch-detected-for-runtimelibrary – Alan Birtles Jun 02 '21 at 13:54
  • I used already RuntimeLibrary: Multi-Threaded-Debug DLL(MDd), but it is not work – SMax23 Jun 02 '21 at 13:58
  • @AlanBirtles I disagree with marking the question as a dupe. OP is running into a problem that is common and highly specific to the library they are using due to it being designed in a weird way for regulatory purposes. Just handwaving it as a general "unresolved external symbol" issue is simply not correct. –  Jun 02 '21 at 14:01
  • @Frank Linking to a dll lib but not providing the appropriate `#define` to make the headers declare `dllimport` rather than static functions is not unique to cryptopp and is a pretty common issue, I've used cryptopp extensively and I'm not aware of any weirdness in the way its designed – Alan Birtles Jun 02 '21 at 14:08
  • @AlanBirtles Fair enough. Maybe I'm mistaken, but I was under the impression OP was running into the DLL only implementing a subset of the library (which is weird part I was referring to) I guess correctly setting the define would also catch that though –  Jun 02 '21 at 14:09
  • @Frank, no it just defaults to static linking unless you [`#define CRYPTOPP_IMPORTS`](https://github.com/weidai11/cryptopp/blob/926543ef661c8af2e0f1a44cdc0f5fc8a329e974/config_dll.h#L125), e.g. see https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix/12574423#12574423 – Alan Birtles Jun 02 '21 at 14:12
  • I was wrong, it was necessary to build the cryptolib library with the same parameters RuntimeLibrary, by default it was different – SMax23 Jun 02 '21 at 14:13

0 Answers0