QT 5.0.1 windows下编译使用QCA和qca-ossl
我使用的环境是windows7 x64。
官方的QCA目前版本是2.0.3, 但是是在QT4下编译的,QT5有些方法已经deprecated,所以用QT5编译会报错,我修正了编译不过的地方,具体请查看附件。
编译方法:
1. 设置环境变量(我的QT5.0.1安装在D:\Qt\Qt5.0.1):
QTDIR=D:\Qt\Qt5.0.1\5.0.1\mingw47_32
QTMAKESPEC=D:\Qt\Qt5.0.1\5.0.1\mingw47_32\mkspecs
PATH加上 %QTDIR%\bin;D:\Qt\Qt5.0.1\Tools\MinGW\bin
2.
configure
nmake (or make or mingw32-make)
installwin
或者直接打开qca.pro在QT creator里面进行编译。
安装qca-ossl
1. 下载 OpenSSL 1.0.1c, 安装好;
2. 在c:\新建local目录,把OpenSSL-Win32安装目录下的include全部拷贝到local,拷贝OpenSSL-Win32\lib\MinGW下面的所有文件到C:\local\lib,并把所有*.a文件重命名为*.lib;
目录结构如下:
C:.
├─include
│ └─openssl
│ aes.h
│ applink.c
│ asn1.h
│ asn1t.h
│ asn1_mac.h
│ bio.h
│ blowfish.h
│ bn.h
│ buffer.h
│ camellia.h
│ cast.h
│ cmac.h
│ cms.h
│ comp.h
│ conf.h
│ 。。。
└─lib
├─ libeay32.def
├─ libeay32.lib
├─ ssleay32.def
└─ ssleay32.lib
3.
在D:\Qt\Qt5.0.1\5.0.1\mingw47_32\mkspecs\features里面新建文件winlocal.prf
内容为 WINLOCAL_PREFIX = C:/local
4.
configwin r
qmake
nmake (or make or mingw32-make)
使用的时候copy lib\*.dll %QTDIR%\plugins\crypto
参考文章:http://www.essentialunix.org/index.php?option=com_content&view=article&id=48:qcatutorial&catid=34:qttutorials&Itemid=53