简体   繁体   中英

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:\\QtProjects\\dialogs\\findfiles\\main.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.

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM