Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Compiler doesn't recognize QSslCertificate class when using static library



  • Hi everyone
    I want to build Qt 4.8.5 statically and it's done. Now, I config new qmake for Qt creator. But when I compile my application, I get this error
    @error: 'QSslCertificate' has not been declared@
    I'm using a QSslCertificate object in my project. The compiler with new static qmake doesn't recognize this class. I have included
    @#include <QtCore>
    #include <QtGui>
    #include <QtNetwork/QSslCertificate>
    #include <QtNetwork/QSslKey>@

    and no errors found when using shared library (I have both shared and static library in seperated path).

    Any problems with when ./configure parameter when I do build statically:
    @
    ./configure -prefix /usr/local/Trolltech/Qt-4.8.5_static -largefile -static -qt-libjpeg -qt-libpng -qt-libmng -qt-zlib -debug-and-release -phonon -phonon-backend -svg -dbus -script -qt-sql-mysql -multimedia -audio-backend -opengl -stl -glib -xrender -xshape -xcursor -xinput -xrandr -xfixes -xsync -xkb -xmlpatterns -fontconfig -glib -mitshm -sm -pch -nis -cups -gtkstyle -nomake demos -nomake examples -nomake tools
    @
    How can I build statically Qt library with all libraries?
    Please help me!!
    Thank you


  • Lifetime Qt Champion

    Hi,

    AFAICS, you didn't enable any openssl option when building your static Qt



  • Thanks SGalst for your reply
    I have tried build Qt normally, I mean non-static.

    just ./configure
    make and make install

    After everything is done, I open my project and this shows the same error.
    @error: 'QSslCertificate' has not been declared@
    What do I have to do? rebuild Qt library again with openssl option enable?
    it takes me more than 2 hours :(



  • Does it required openssl installed? Because when I build Qt, the Ubuntu hasn't been installed openssl.


  • Lifetime Qt Champion

    Yes it does

    Qt doesn't include OpenSSL



  • Hi SGaist
    After install openssl package
    I've re-build Qt4.8.5 no-static
    ./configurate
    make
    make install

    but it cannot find "QSslCertificate"

    @error: 'QSslCertificate' has not been declared@

    My project is using this class.
    I'm using Ubuntu 12.10 x64 and QtCreator 2.8.0



  • Hi, I figured out somthing...
    I've installed Qt4.8.5 on Ubuntu 12.10 32bits. It created "qmake-qt4" file located in /usr/bin and QtCreator using this file as Qt Version to compile qt project. When using that My project has no errors. When I config that linked Qt Version to "qmake" file located in /usr/local/Trolltech/Qt4.8.5/bin and compile my project, the errors:
    @error: 'QSslCertificate' has not been declared@
    appear. So, I use "qmake-qt4" as my current Qt Version on Ubuntu 12.10 32 bits.

    Now, I use the same Qt4.8.5 source code library to build on Ubuntu 64bits.
    After done, I cannot found "qmake-qt4" file in /usr/bin. My QtCreator cannot detect Qt Version automatically. So, I have to manually add Qt Version by browsing to "qmake" located in /usr/local/Trolltech/Qt4.8.5/bin and of course,
    @error: 'QSslCertificate' has not been declared@
    appear like on Ubuntu 32 bits.
    I wonder that, the reason either is my gcc 64 bits or Qt library source?
    I can't see the seperate sources for Ubuntu 32 bits and 64 bits. They use the same source code.
    Any ideas?
    Thank you


  • Lifetime Qt Champion

    When configuring Qt check the log to see if it found openssl. If not add the -I and -L parameters to tell Qt where to find the includes and libs


Log in to reply