尝试在我的 Qt 项目中使用 OpenSSL,这是我的环境:
- 操作系统:Win7 32位
- Qt:Qt Creator 4.2.1 社区
- Qt 套件:Qt_5_8_0_MSVC2015_32bit2
- Openssl:Win32 OpenSSL v1.1.0e,下载形式 this site
我正在尝试 include <openssl/evp.h>
然而,在我的代码中,当我添加 #include <openssl/evp.h>
时在我的 main.cpp 和构建中,Qt Creator 显示以下错误:D:\QtProjects\dialogs\findfiles\main.cpp:50: error: C1083: 'openssl/evp.h':No such file or directory
我已经按照这个问题中的说明进行操作:How to Include OpenSSL in a Qt project
我的 .pro 文件如下所示:
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
请帮我解决这个问题。
最佳答案
将此作为答案发布,因为我很确定我已经弄明白了。
您必须在构建之前运行 Qmake,否则您的 pro 文件中的更改不会受到影响。由于 Qmake 正在将您的 pro 文件编译成 makefile
构建->运行 QMake
为我的 OpenSSL 库工作。
祝你好运!
关于c++ - Qt中如何实现OpenSSL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43384887/