如何在Qt中实现OpenSSL? [英] How to implement OpenSSL in Qt?

查看:203
本文介绍了如何在Qt中实现OpenSSL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在我的Qt项目中使用OpenSSL,这是我的环境:

Trying to use OpenSSL in my Qt project, here is my environment:

  • 操作系统:Win7 32bit
  • Qt:Qt Creator 4.2.1社区
  • Qt工具包:Qt_5_8_0_MSVC2015_32bit2
  • Openssl:Win32 OpenSSL v1.1.0e,已从此站点
  • OS: Win7 32bit
  • Qt: Qt Creator 4.2.1 Community
  • Qt Kit: Qt_5_8_0_MSVC2015_32bit2
  • Openssl: Win32 OpenSSL v1.1.0e, downloaded form this site

我正在尝试在代码中添加include <openssl/evp.h>,但是,当我在main.cpp中添加#include <openssl/evp.h>并进行构建时,Qt Creator显示以下错误:D:\QtProjects\dialogs\findfiles\main.cpp:50: error: C1083: 'openssl/evp.h':No such file or directory

I'm trying to include <openssl/evp.h> in my code, however, when I add #include <openssl/evp.h> in my main.cpp and build, Qt Creator shows the following error: D:\QtProjects\dialogs\findfiles\main.cpp:50: error: C1083: 'openssl/evp.h':No such file or directory

我已经按照此问题中的说明进行操作:如何包含Qt项目中的OpenSSL

I have already followed the instructions in this question: How to Include OpenSSL in a Qt project

我的.pro文件如下:

My .pro file looks like:

QT += widgets

HEADERS       = window.h
SOURCES       = main.cpp \
                window.cpp

# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/dialogs/findfiles
INSTALLS += target

# for openssl - I added these 2 lines
LIBS += -LC:/OpenSSL-Win32/lib -llibcrypto
INCLUDEPATH += C:/OpenSSL-Win32/include

请帮助我解决此问题.

推荐答案

将其发布为答案,因为我很确定我已经弄清楚了.

Posting this as an answer because iam pretty sure i figured it out.

您必须在构建之前运行Qmake,否则pro File中的更改将不会受到影响.由于Qmake正在将您的pro文件编译为makefile

You have to run Qmake before building, otherwise changes in your pro File will not be affected. Since Qmake is compiling your pro File into a makefile

Build->运行QMake

为我的OpenSSL库工作.

Worked for my OpenSSL library.

祝你好运!

这篇关于如何在Qt中实现OpenSSL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆