1

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.

jww
  • 97,681
  • 90
  • 411
  • 885
Eumaa
  • 971
  • 2
  • 15
  • 38
  • 1
    Does `C:/OpenSSL-Win32/include/openssl/evp.h` exist? – zhm Apr 13 '17 at 06:23
  • Yes, it exists. – Eumaa Apr 13 '17 at 06:26
  • wondering does my problem have something to do with me installing my Qt in D:Qt, instead of C:Qt... – Eumaa Apr 13 '17 at 06:39
  • That should not be the problem. Try changing `C:/xxx` to `C:\xxx`? – zhm Apr 13 '17 at 06:40
  • Changed the INCLUDEPATH from **C:/xxx** to **C:\xxx**, still error. – Eumaa Apr 13 '17 at 06:56
  • Try the Library Add Dialog. Right Click in your "makefile" and choose Add Library -> External Library. Maybe this adds more Information – ShuzZzle Apr 13 '17 at 07:40
  • [Add OpenSSL support for Linux Qt Application](https://stackoverflow.com/q/47630402/608639), [How to Include OpenSSL in a Qt project](https://stackoverflow.com/q/14681012/608639), [Changing OpenSSL include path for qmake](https://stackoverflow.com/q/20592001/608639), [How to tell Qt to use different OpenSSL](https://stackoverflow.com/q/40429278/608639), [How to implement OpenSSL in Qt?](https://stackoverflow.com/q/43384887/608639), [Is there any way to building static Qt with static OpenSSL?](https://stackoverflow.com/q/20843180/608639), etc – jww Jan 14 '18 at 09:19

1 Answers1

2

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!

ShuzZzle
  • 192
  • 1
  • 9