0

I have some problems integrating CryptoPP in Visual Studio. I've followed some tutorials without success, and when I try to compile the project I get hundreads of errors.

What I did:

  1. I builded cryptlib with both debug and release configurations, generating the cryptlib.lib files
  2. I added the dependencies to the .lib files that I've just generated
  3. I added the paths to the .h files

When compiling my project, I get more than 100 errors of the type LNKxxxx, I don't know if I did something wrong while compiling the libraries, or if I miss something, but I'm completely stuck.

--- EDIT --- As requested, here are some of the errors I get

Error LNK2038 mismatch detected for 'RuntimeLibrary': the value 'MTd_StaticDebug' does not match the value 'MDd_DynamicDebug' in pwmc.obj pwmc C:\Users\aless\Documents\C\pwm\pwmc\pwmc\cryptlib.lib(rijndael.obj) 1

Error LNK2005 "protected: __cdecl std::basic_streambuf<char,struct std::char_traits >::basic_streambuf<char,struct std::char_traits >(void)" (??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAA@XZ) already defined in cryptlib.lib(cryptlib.obj) pwmc C:\Users\aless\Documents\C\pwm\pwmc\pwmc\msvcprtd.lib(MSVCP140D.dll) 1

Error LNK2005 "private: static class std::locale::_Locimp * __cdecl std::locale::_Init(bool)" (?_Init@locale@std@@CAPEAV_Locimp@12@_N@Z) already defined in msvcprtd.lib(MSVCP140D.dll) pwmc C:\Users\aless\Documents\C\pwm\pwmc\pwmc\libcpmtd.lib(locale0.obj) 1

Since my Visual Studio is not in english I translated the errors myself, but I don't know the exact/correct translation, I hope that is clear enough anyway.


Thanks in advance to everyone.

PS I don't think my code is the problem, to test if all were working i used this sample code

drescherjm
  • 10,365
  • 5
  • 44
  • 64
  • 2
    _"When compiling my project, I get more than 100 errors of the type LNKxxxx"_ -- well then, since you're here asking for help, why on earth are you not showing them as part of your question? At _least_ the first few errors might help explain the issue. – paddy Jan 26 '21 at 00:09
  • 1
    This means you likely forgot to add a lib or perhaps your lib files are not in the correct folder or perhaps you are mixing 32 and 64 bit. We would need to see the exact text of the error messages to help (at least some of them). – drescherjm Jan 26 '21 at 00:36
  • 1
    ***is there a "well made" tutorial*** Tutorial requests are officially listed as off-topic at StackOverflow. – drescherjm Jan 26 '21 at 00:38
  • 2
    Try to install it with [vcpkg](https://vcpkg.readthedocs.io/en/latest/). –  Jan 26 '21 at 00:45
  • Thanks for the answers, I updated the question with some of the errors, I don't know if it's enough, but they are more or less the samem the only thing that changes is the file. – Alessandro Mian Jan 26 '21 at 09:38
  • @drescherjm I built cryptopp only in 64, and when I try to compile my project I'm making sure that I compile in 64. I think I did something wrong when compiling because I tried to build cryptdll instead of cryptlib and I only get one error, so I don't know what I'm doing wrong. – Alessandro Mian Jan 26 '21 at 09:42
  • Ok, I solved using vcpkg, thanks a lot to @adembudak for the suggestion. What I was doing in Visual Studio with my project was correct, so probably I made a mistake when compiling the cryptopp libraries. – Alessandro Mian Jan 26 '21 at 13:21
  • The first error is something that you can google. The answer for that is the runtime library for your application must match the third party library you use. With that said glad you solved it. – drescherjm Jan 26 '21 at 14:19

0 Answers0