How to add Crypto++ library to Qt project

冷暖自知 提交于 2019-12-01 06:37:18
win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/libcryptlib.a
else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/libcryptlibd.a

On Windows under Visual Studio, the name of the Crypto++ library is cryptlib.lib, not libcryptlib.a. If you used Cygwin (which I don't believe you did), then the name would be libcryptopp.a.

The libcryptlibd.a (notice the addition of the d) is probably not correct. It stands for 'debug', and its something that was used years ago in the Visual Studio 5.0/6.0 days. It was based on Compiling and Integrating Crypto++ into the Microsoft Visual C++ Environment. If you renamed Win32/Debug/cryptlib.lib to Win32/Debug/cryptlibd.lib, then you are probably OK if your paths are OK.

I think the recommended way of doing things now is to use cryptlib.lib as the library (same name everywhere), and change the linker paths based on the configuration. The paths would be:

  • Win32, Debug: <crypto++ dir>/Win32/Debug/
  • Win64, Debug: <crypto++ dir>/x64/Debug/
  • Win32, Release: <crypto++ dir>/Win32/Release/
  • Win64, Release: <crypto++ dir>/x64/Release/

Here's a screen capture of adding cryptlib.lib under Visual Studio. Notice it applies to all configurations:

And here's how to change the linker paths so Visual Studio finds the proper cryptlib.lib:

In the above, CRYPTOPP_LIB32 would be an environmental variable with a value like C:\Users\Special Services\Crypto++\Win32\. Similarly, CRYPTOPP_LIB64 would be C:\Users\Special Services\Crypto++\x64\

Unfortunately, I don't know how to do these things under QtCreator.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!