Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
927 views
in Technique[技术] by (71.8m points)

c++ - How to implement OpenSSL in Qt?

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

  • 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

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

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

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

Please help me fix this.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

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->Run QMake

Worked for my OpenSSL library.

Good Luck!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...