问题描述
尝试在我的 Qt 项目中使用 OpenSSL,这是我的环境:
Trying to use OpenSSL in my Qt project, here is my environment:
- 操作系统:Win7 32 位
- Qt:Qt Creator 4.2.1 社区
- Qt 套件:Qt_5_8_0_MSVC2015_32bit2
- Openssl:Win32 OpenSSL v1.1.0e,下载形式本站
我试图在我的代码中include
,但是,当我添加#include
在我的 main.cpp 和构建中,Qt Creator 显示以下错误:D:QtProjectsdialogsfindfilesmain.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:QtProjectsdialogsfindfilesmain.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 文件中的更改不会受到影响.由于 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
构建->运行 QMake
为我的 OpenSSL 库工作.
Worked for my OpenSSL library.
祝你好运!
这篇关于如何在 Qt 中实现 OpenSSL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!