如何在 Qt 中实现 OpenSSL?

2024-08-14C/C++开发问题
6

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

问题描述

尝试在我的 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

无法访问 C++ std::set 中对象的非常量成员函数
Unable to access non-const member functions of objects in C++ std::set(无法访问 C++ std::set 中对象的非常量成员函数)...
2024-08-14 C/C++开发问题
17

从 lambda 构造 std::function 参数
Constructing std::function argument from lambda(从 lambda 构造 std::function 参数)...
2024-08-14 C/C++开发问题
25

STL BigInt 类实现
STL BigInt class implementation(STL BigInt 类实现)...
2024-08-14 C/C++开发问题
3

使用 std::atomic 和 std::condition_variable 同步不可靠
Sync is unreliable using std::atomic and std::condition_variable(使用 std::atomic 和 std::condition_variable 同步不可靠)...
2024-08-14 C/C++开发问题
17

在 STL 中将列表元素移动到末尾
Move list element to the end in STL(在 STL 中将列表元素移动到末尾)...
2024-08-14 C/C++开发问题
9

为什么禁止对存储在 STL 容器中的类重载 operator&amp;()?
Why is overloading operatoramp;() prohibited for classes stored in STL containers?(为什么禁止对存储在 STL 容器中的类重载 operatoramp;()?)...
2024-08-14 C/C++开发问题
6