QT添加openssl的方法



Assuming Windows you can download its installation from Win32 OpenSSL Installation Project page. You need to download this one for 64-bit windows developing or this one for 32-bit. Just run the stup and every thing will be done easily. The default installation directory is : C:\OpenSSL-Win32
In Qt creator if want to link a library to your project you can just add this line to your .pro file(project file ) :

LIBS += -L/path/to -llibname

So here's what we do for this library( for example to link ubsec.lib )

LIBS += -LC:/OpenSSL-Win32/lib -lubsec

Pay attention to -L and -l.See this question. You don't even need to specify .lib at the end of the library name.

For including .h files add this line to your .pro file :

INCLUDEPATH += C:/OpenSSL-Win32/include

after that you can include a file like this :

#include <openssl/aes.h>
转自:http://stackoverflow.com/questions/14681012/how-to-include-openssl-in-qt-creator
PS:外国社区的人答题就是认真仔细啊!值得学习!

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Qt OpenSSL支持是通过Qt的QSslSocket类实现的。要在Qt中使用OpenSSL,首先需要添加OpenSSL库的支持。 根据引用中的Qt官方文档,可以找到关于添加OpenSSL支持的详细说明。根据文档中的说明,要在Qt添加OpenSSL支持,需要按照以下步骤进行操作: 1. 在Qt源码目录中找到OpenSSL的存档文件(通常为.tar.gz或.zip格式)。 2. 解压存档文件,并进入解压后的目录。 3. 打开命令提示符或终端,并导航到解压后的目录。 4. 运行以下命令来配置OpenSSL的构建: ``` ./configure ``` 可以根据需要添加其他选项来自定义构建设置。 5. 运行以下命令开始构建和安装OpenSSL: ``` make make install ``` 注意,可能需要管理员权限才能成功运行`make install`命令。 6. 等待安装完成后,OpenSSL库就已经成功地添加Qt中了。 然后,根据引用中的代码片段,您可以使用以下代码来打印查看当前版本的Qt所依赖的OpenSSL版本: ``` qDebug() << QSslSocket::sslLibraryBuildVersionString(); ``` 另外,引用提供了在OpenSSL git仓库日志中查找特定版本的描述的方法。通过查看OpenSSL的git仓库日志,您可以找到与Qt所使用的OpenSSL版本相对应的提交。 总结起来,为了在Qt中使用OpenSSL,您需要按照Qt官方文档的说明添加OpenSSL支持,并且可以使用QSslSocket::sslLibraryBuildVersionString()函数来获取当前Qt所依赖的OpenSSL版本信息。同时,通过查看OpenSSL的git仓库日志,您可以找到特定版本的详细描述。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值