How to Include OpenSSL in a Qt project

前端 未结 5 1077
旧时难觅i
旧时难觅i 2020-11-27 17:00

I\'m new to Qt, I\'ve done some Googleing and can\'t find a detailed enough answer.

I need to use OpenSSL in my qmake-based Qt project. How do I go about downloading

5条回答
  •  臣服心动
    2020-11-27 17:48

    Assuming Windows, you can download its installation from Win32 OpenSSL Installation Project page. You can choose one for 64-bit windows developing or for 32-bit. Just run the setup and everything will be done easily. The default installation directory is : C:\OpenSSL-Win32
    In Qt creator, if you then want to link a library to your project you can just add this line to your .pro file(project file ) :

    LIBS += -L/path/to -llibname
    

    So here's what we do for this library( for example to link ubsec.lib )

    LIBS += -LC:/OpenSSL-Win32/lib -lubsec
    

    Pay attention to -L and -l.See this question. You don't even need to specify .lib at the end of the library name.

    For including .h files add this line to your .pro file :

    INCLUDEPATH += C:/OpenSSL-Win32/include
    

    after that you can include a file like this :

    #include 
    

提交回复
热议问题