1、准备如下几项内容:
a、WIN10环境下的QT5.15.2安装包,QTCreator对应版本安装。(自行安装)
b、cryptopp562安装包下载,官网:https://www.cryptopp.com/,这里没选择最新的8.7是因为mingw-32编译后的库文件使用有问题,有错误,但是5.6用同样的方式编译就可以正常使用。
2、使用QT环境编译cryptopp562,解压源码包,命令行模式下:qmake -project生成 .Pro文件,修改内容:TEMPLATE = lib,
增加:
cpp
DEFINES += CRYPTOPPLIB_LIBRARY
DESTDIR=$PWD/bin
3、命令模式执行:
qmake
mingw32-make all
注意:此处的 mingw32-make.exe文件要跟qtcreator开发环境下的项目编译环境一直,这样才能保证编译后的dll和a文件能正确调用。
编译无错误生成:libcryptopp562.a 和 cryptopp562.dll文件。
4、新建Qt开发项目,可以是widgets或者console程序,目录下新建目录(根据个人喜好):libs\cryptopp\include 和libs\cryptopp\lib。
6、拷贝crypto5.6源码目录下的所有h文件到上面的include目录。拷贝编译后的libcryptopp562.a 和 cryptopp562.dll文件到lib目录。
7、编辑程序项目pro文件,
增加:
cpp
HEADERS += \
libs/cryptopp/include/3way.h \
libs/cryptopp/include/adler32.h \
libs/cryptopp/include/adv_simd.h \
libs/cryptopp/include/aes.h \
libs/cryptopp/include/aes_armv4.h \
libs/cryptopp/include/algebra.h \
libs/cryptopp/include/algparam.h \
libs/cryptopp/include/allocate.h \
libs/cryptopp/include/arc4.h \
libs/cryptopp/include/argnames.h \
libs/cryptopp/include/aria.h \
libs/cryptopp/include/arm_simd.h \
libs/cryptopp/include/asn.h \
libs/cryptopp/include/authenc.h \
libs/cryptopp/include/base32.h \
libs/cryptopp/include/base64.h \
libs/cryptopp/include/basecode.h \
libs/cryptopp/include/bench.h \
libs/cryptopp/include/blake2.h \
libs/cryptopp/include/blowfish.h \
libs/cryptopp/include/blumshub.h \
libs/cryptopp/include/camellia.h \
libs/cryptopp/include/cast.h \
libs/cryptopp/include/cbcmac.h \
libs/cryptopp/include/ccm.h \
libs/cryptopp/include/chacha.h \
libs/cryptopp/include/chachapoly.h \
libs/cryptopp/include/cham.h \
libs/cryptopp/include/channels.h \
libs/cryptopp/include/cmac.h \
libs/cryptopp/include/config.h \
libs/cryptopp/include/config_align.h \
libs/cryptopp/include/config_asm.h \
libs/cryptopp/include/config_cpu.h \
libs/cryptopp/include/config_cxx.h \
libs/cryptopp/include/config_dll.h \
libs/cryptopp/include/config_int.h \
libs/cryptopp/include/config_misc.h \
libs/cryptopp/include/config_ns.h \
libs/cryptopp/include/config_os.h \
libs/cryptopp/include/config_ver.h \
libs/cryptopp/include/cpu.h \
libs/cryptopp/include/crc.h \
libs/cryptopp/include/cryptlib.h \
libs/cryptopp/include/darn.h \
libs/cryptopp/include/default.h \
libs/cryptopp/include/des.h \
libs/cryptopp/include/dh.h \
libs/cryptopp/include/dh2.h \
libs/cryptopp/include/dll.h \
libs/cryptopp/include/dmac.h \
libs/cryptopp/include/donna.h \
libs/cryptopp/include/donna_32.h \
libs/cryptopp/include/donna_64.h \
libs/cryptopp/include/donna_sse.h \
libs/cryptopp/include/drbg.h \
libs/cryptopp/include/dsa.h \
libs/cryptopp/include/eax.h \
libs/cryptopp/include/ec2n.h \
libs/cryptopp/include/eccrypto.h \
libs/cryptopp/include/ecp.h \
libs/cryptopp/include/ecpoint.h \
libs/cryptopp/include/elgamal.h \
libs/cryptopp/include/emsa2.h \
libs/cryptopp/include/eprecomp.h \
libs/cryptopp/include/esign.h \
libs/cryptopp/include/factory.h \
libs/cryptopp/include/fhmqv.h \
libs/cryptopp/include/files.h \
libs/cryptopp/include/filters.h \
libs/cryptopp/include/fips140.h \
libs/cryptopp/include/fltrimpl.h \
libs/cryptopp/include/gcm.h \
libs/cryptopp/include/gf256.h \
libs/cryptopp/include/gf2_32.h \
libs/cryptopp/include/gf2n.h \
libs/cryptopp/include/gfpcrypt.h \
libs/cryptopp/include/gost.h \
libs/cryptopp/include/gzip.h \
libs/cryptopp/include/hashfwd.h \
libs/cryptopp/include/hc128.h \
libs/cryptopp/include/hc256.h \
libs/cryptopp/include/hex.h \
libs/cryptopp/include/hight.h \
libs/cryptopp/include/hkdf.h \
libs/cryptopp/include/hmac.h \
libs/cryptopp/include/hmqv.h \
libs/cryptopp/include/hrtimer.h \
libs/cryptopp/include/ida.h \
libs/cryptopp/include/idea.h \
libs/cryptopp/include/integer.h \
libs/cryptopp/include/iterhash.h \
libs/cryptopp/include/kalyna.h \
libs/cryptopp/include/keccak.h \
libs/cryptopp/include/lea.h \
libs/cryptopp/include/lsh.h \
libs/cryptopp/include/lubyrack.h \
libs/cryptopp/include/luc.h \
libs/cryptopp/include/mars.h \
libs/cryptopp/include/md2.h \
libs/cryptopp/include/md4.h \
libs/cryptopp/include/md5.h \
libs/cryptopp/include/mdc.h \
libs/cryptopp/include/mersenne.h \
libs/cryptopp/include/misc.h \
libs/cryptopp/include/modarith.h \
libs/cryptopp/include/modes.h \
libs/cryptopp/include/modexppc.h \
libs/cryptopp/include/mqueue.h \
libs/cryptopp/include/mqv.h \
libs/cryptopp/include/naclite.h \
libs/cryptopp/include/nbtheory.h \
libs/cryptopp/include/nr.h \
libs/cryptopp/include/oaep.h \
libs/cryptopp/include/oids.h \
libs/cryptopp/include/osrng.h \
libs/cryptopp/include/ossig.h \
libs/cryptopp/include/padlkrng.h \
libs/cryptopp/include/panama.h \
libs/cryptopp/include/pch.h \
libs/cryptopp/include/pkcspad.h \
libs/cryptopp/include/poly1305.h \
libs/cryptopp/include/polynomi.h \
libs/cryptopp/include/ppc_simd.h \
libs/cryptopp/include/pssr.h \
libs/cryptopp/include/pubkey.h \
libs/cryptopp/include/pwdbased.h \
libs/cryptopp/include/queue.h \
libs/cryptopp/include/rabbit.h \
libs/cryptopp/include/rabin.h \
libs/cryptopp/include/randpool.h \
libs/cryptopp/include/rc2.h \
libs/cryptopp/include/rc5.h \
libs/cryptopp/include/rc6.h \
libs/cryptopp/include/rdrand.h \
libs/cryptopp/include/resource.h \
libs/cryptopp/include/rijndael.h \
libs/cryptopp/include/ripemd.h \
libs/cryptopp/include/rng.h \
libs/cryptopp/include/rsa.h \
libs/cryptopp/include/rw.h \
libs/cryptopp/include/safer.h \
libs/cryptopp/include/salsa.h \
libs/cryptopp/include/scrypt.h \
libs/cryptopp/include/seal.h \
libs/cryptopp/include/secblock.h \
libs/cryptopp/include/secblockfwd.h \
libs/cryptopp/include/seckey.h \
libs/cryptopp/include/seed.h \
libs/cryptopp/include/serpent.h \
libs/cryptopp/include/serpentp.h \
libs/cryptopp/include/sha.h \
libs/cryptopp/include/sha1_armv4.h \
libs/cryptopp/include/sha256_armv4.h \
libs/cryptopp/include/sha3.h \
libs/cryptopp/include/sha512_armv4.h \
libs/cryptopp/include/shacal2.h \
libs/cryptopp/include/shake.h \
libs/cryptopp/include/shark.h \
libs/cryptopp/include/simeck.h \
libs/cryptopp/include/simon.h \
libs/cryptopp/include/simple.h \
libs/cryptopp/include/siphash.h \
libs/cryptopp/include/skipjack.h \
libs/cryptopp/include/sm3.h \
libs/cryptopp/include/sm4.h \
libs/cryptopp/include/smartptr.h \
libs/cryptopp/include/sosemanuk.h \
libs/cryptopp/include/speck.h \
libs/cryptopp/include/square.h \
libs/cryptopp/include/stdcpp.h \
libs/cryptopp/include/strciphr.h \
libs/cryptopp/include/tea.h \
libs/cryptopp/include/threefish.h \
libs/cryptopp/include/tiger.h \
libs/cryptopp/include/trap.h \
libs/cryptopp/include/trunhash.h \
libs/cryptopp/include/ttmac.h \
libs/cryptopp/include/tweetnacl.h \
libs/cryptopp/include/twofish.h \
libs/cryptopp/include/validate.h \
libs/cryptopp/include/vmac.h \
libs/cryptopp/include/wake.h \
libs/cryptopp/include/whrlpool.h \
libs/cryptopp/include/words.h \
libs/cryptopp/include/xed25519.h \
libs/cryptopp/include/xtr.h \
libs/cryptopp/include/xtrcrypt.h \
libs/cryptopp/include/xts.h \
libs/cryptopp/include/zdeflate.h \
libs/cryptopp/include/zinflate.h \
libs/cryptopp/include/zlib.h
INCLUDEPATH += $$PWD/libs/cryptopp/include
DEPENDPATH += $$PWD/libs/cryptopp/include
LIBS += -L$$PWD/libs/cryptopp/lib -llibcryptopp562