Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem with include openssl on Qt Andrioid
Forum Updated to NodeBB v4.3 + New Features

Problem with include openssl on Qt Andrioid

Scheduled Pinned Locked Moved Solved General and Desktop
19 Posts 5 Posters 2.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Creatorczyk
    28 Mar 2022, 09:22

    Hi,
    I want to add openssl library to my Qt Android mobile application. So downloaded package form
    https://www.openssl.org/source/
    and I build library without any problem

    export PATH="/home/john/Android/Sdk/ndk/android-ndk-r21e/toolchains/llvm/prebuilt/linux-x86_64/bin":$PATH
    export ANDROID_NDK_HOME=/home/john/Android/Sdk/ndk/android-ndk-r21e
    ./Configure shared android-x86_64 -D__ANDROID_API__=21
    make -j$(nproc) SHLIB_VERSION_NUMBER= SHLIB_EXT=_1_1.so build_libs
    

    My .pro file

    INCLUDEPATH += /home/john/openssl-1.1.1n/include
    LIBS += /home/john/openssl-1.1.1n/libssl.a
    LIBS += /home/john/openssl-1.1.1n/libcrypto.a
    

    But when I tried build project, I got errors like belows:

    :-1: error: error: /home/john/openssl-1.1.1n/libcrypto.a(bio_lib.o): incompatible target
    :-1: error: error: /home/john/openssl-1.1.1n/libcrypto.a(bss_mem.o): incompatible target
    :-1: error: error: /home/john/openssl-1.1.1n/libcrypto.a(conf_sap.o): incompatible target
    :-1: error: error: /home/john/openssl-1.1.1n/libcrypto.a(cpt_err.o): incompatible target
    :-1: error: error: /home/john/openssl-1.1.1n/libcrypto.a(err.o): incompatible target
    :-1: error: error: /home/john/openssl-1.1.1n/libcrypto.a(init.o): incompatible target
    :-1: error: error: /home/john/openssl-1.1.1n/libcrypto.a(pem_all.o): incompatible target
    :-1: error: error: /home/john/openssl-1.1.1n/libcrypto.a(rsa_crpt.o): incompatible target
    :-1: error: error: /home/john/openssl-1.1.1n/libcrypto.a(rsa_lib.o): incompatible target
    :-1: error: /home/john/openssl-1.1.1n/libcrypto.a(bio_lib.o): Relocations in generic ELF (EM: 62)
    :-1: error: /home/john/openssl-1.1.1n/libcrypto.a(bio_lib.o): Relocations in generic ELF (EM: 62)
    

    Why am I getting such an error?

    L Offline
    L Offline
    lemons
    wrote on 28 Mar 2022, 10:05 last edited by
    #2

    It does not answer your question, but maybe this repo is a suitable solution: https://github.com/KDAB/android_openssl
    It just requires a single line in your .pro file

    C 1 Reply Last reply 28 Mar 2022, 11:28
    0
    • L lemons
      28 Mar 2022, 10:05

      It does not answer your question, but maybe this repo is a suitable solution: https://github.com/KDAB/android_openssl
      It just requires a single line in your .pro file

      C Offline
      C Offline
      Creatorczyk
      wrote on 28 Mar 2022, 11:28 last edited by
      #3

      @lemons I tried but it doesn't work. So I try myself build libs. I use Qt 5.15.2, maybe it's couse of problem

      K 1 Reply Last reply 28 Mar 2022, 11:48
      0
      • C Creatorczyk
        28 Mar 2022, 11:28

        @lemons I tried but it doesn't work. So I try myself build libs. I use Qt 5.15.2, maybe it's couse of problem

        K Offline
        K Offline
        KroMignon
        wrote on 28 Mar 2022, 11:48 last edited by KroMignon
        #4

        @Creatorczyk said in Problem with include openssl on Qt Andrioid:

        I use Qt 5.15.2, maybe it's couse of problem

        AFAIK, you have to install open ssl libs with help Qt Creator.
        In Tools / Options select Devices and go to tab Android
        There you will find a button called "Download OpenSSL"
        f6e14480-17d4-4e45-98da-a5f70b05a637-image.png

        [EDIT]: After that you have to include the libs in your PRO / CMakeLists.txt file as explained here: https://doc.qt.io/qt-5/android-openssl-support.html#using-openssl-libraries-with-qt-for-android

        In my case it would be

        • for qmake:
        android: include(c:/Android/android-sdk/android_openssl/openssl.pri)
        
        • for cmake:
        if (ANDROID)
            include(c:/Android/android-sdk/android_openssl/CMakeLists.txt)
        endif()
        

        It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

        C 8 2 Replies Last reply 28 Mar 2022, 13:23
        1
        • K KroMignon
          28 Mar 2022, 11:48

          @Creatorczyk said in Problem with include openssl on Qt Andrioid:

          I use Qt 5.15.2, maybe it's couse of problem

          AFAIK, you have to install open ssl libs with help Qt Creator.
          In Tools / Options select Devices and go to tab Android
          There you will find a button called "Download OpenSSL"
          f6e14480-17d4-4e45-98da-a5f70b05a637-image.png

          [EDIT]: After that you have to include the libs in your PRO / CMakeLists.txt file as explained here: https://doc.qt.io/qt-5/android-openssl-support.html#using-openssl-libraries-with-qt-for-android

          In my case it would be

          • for qmake:
          android: include(c:/Android/android-sdk/android_openssl/openssl.pri)
          
          • for cmake:
          if (ANDROID)
              include(c:/Android/android-sdk/android_openssl/CMakeLists.txt)
          endif()
          
          C Offline
          C Offline
          Creatorczyk
          wrote on 28 Mar 2022, 13:23 last edited by
          #5

          @KroMignon I tried your solution before but I got error like below:

          a192b260-6823-4e65-a711-1bf9686b8583-image.png

          Could this be a problem with my Qt 5.15.2?

          K 1 Reply Last reply 28 Mar 2022, 13:38
          0
          • C Creatorczyk
            28 Mar 2022, 13:23

            @KroMignon I tried your solution before but I got error like below:

            a192b260-6823-4e65-a711-1bf9686b8583-image.png

            Could this be a problem with my Qt 5.15.2?

            K Offline
            K Offline
            KroMignon
            wrote on 28 Mar 2022, 13:38 last edited by
            #6

            @Creatorczyk said in Problem with include openssl on Qt Andrioid:

            Could this be a problem with my Qt 5.15.2?

            Not really. the pri file only includes the library to the project. It do not add any header file in INCLUDEPATH or DEPENDPATH
            Why do you include openssl headers in you C++ file?

            It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

            C 1 Reply Last reply 28 Mar 2022, 14:16
            0
            • K KroMignon
              28 Mar 2022, 13:38

              @Creatorczyk said in Problem with include openssl on Qt Andrioid:

              Could this be a problem with my Qt 5.15.2?

              Not really. the pri file only includes the library to the project. It do not add any header file in INCLUDEPATH or DEPENDPATH
              Why do you include openssl headers in you C++ file?

              C Offline
              C Offline
              Creatorczyk
              wrote on 28 Mar 2022, 14:16 last edited by
              #7

              @KroMignon Because I want to use functions from lib to encode RSA.

              I added:

              INCLUDEPATH += /home/john/openssl_test/static/include/
              

              The bug with headers has resolved, but although intelisense can see functions, the application still does not build

              ec027265-3393-4ada-b385-8286d85b64d6-image.png

              K 1 Reply Last reply 28 Mar 2022, 14:27
              0
              • C Creatorczyk
                28 Mar 2022, 14:16

                @KroMignon Because I want to use functions from lib to encode RSA.

                I added:

                INCLUDEPATH += /home/john/openssl_test/static/include/
                

                The bug with headers has resolved, but although intelisense can see functions, the application still does not build

                ec027265-3393-4ada-b385-8286d85b64d6-image.png

                K Offline
                K Offline
                KroMignon
                wrote on 28 Mar 2022, 14:27 last edited by
                #8

                @Creatorczyk said in Problem with include openssl on Qt Andrioid:

                The bug with headers has resolved, but although intelisense can see functions, the application still does not build

                Because you also need to say that you are using the libs ;)
                Add this in your PRO file:

                LIBS += -llibcrypto -llibssl
                

                It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                C 1 Reply Last reply 29 Mar 2022, 06:07
                0
                • K KroMignon
                  28 Mar 2022, 14:27

                  @Creatorczyk said in Problem with include openssl on Qt Andrioid:

                  The bug with headers has resolved, but although intelisense can see functions, the application still does not build

                  Because you also need to say that you are using the libs ;)
                  Add this in your PRO file:

                  LIBS += -llibcrypto -llibssl
                  
                  C Offline
                  C Offline
                  Creatorczyk
                  wrote on 29 Mar 2022, 06:07 last edited by
                  #9

                  @KroMignon It did not help :(

                  140589a6-6460-43a1-b1f4-b2596c8f7405-image.png

                  K 1 Reply Last reply 29 Mar 2022, 06:23
                  0
                  • C Creatorczyk
                    29 Mar 2022, 06:07

                    @KroMignon It did not help :(

                    140589a6-6460-43a1-b1f4-b2596c8f7405-image.png

                    K Offline
                    K Offline
                    KroMignon
                    wrote on 29 Mar 2022, 06:23 last edited by
                    #10

                    @Creatorczyk said in Problem with include openssl on Qt Andrioid:

                    It did not help :(

                    It seems that you have to specify the location of the libs to avoid error error: cannot find XXX
                    According to your posts, you are using Qt 5.15 for Android, so I would suggest to do it as follow:

                    CONFIG(release, debug|release): SSL_PATH = /home/john/openssl_test
                    else: SSL_PATH = /home/john/openssl_test/no-asm
                    
                    contains(ANDROID_TARGET_ARCH, armeabi-v7a) : SSL_PATH = $$SSL_PATH/Qt-5.12.4_5.13.0/arm
                    contains(ANDROID_TARGET_ARCH, arm64-v8a) : SSL_PATH = $$SSL_PATH/Qt-5.12.4_5.13.0/arm64
                    contains(ANDROID_TARGET_ARCH, x86): SSL_PATH = $$SSL_PATH/Qt-5.12.4_5.13.0/x86
                    contains(ANDROID_TARGET_ARCH, x86_64) : SSL_PATH = $$SSL_PATH/Qt-5.12.4_5.13.0/x86_64
                    
                    LIBS += -L$$SSL_PATH -llibcrypto
                    LIBS += -L$$SSL_PATH -llibssl
                    

                    It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                    jsulmJ 1 Reply Last reply 29 Mar 2022, 06:25
                    0
                    • K KroMignon
                      29 Mar 2022, 06:23

                      @Creatorczyk said in Problem with include openssl on Qt Andrioid:

                      It did not help :(

                      It seems that you have to specify the location of the libs to avoid error error: cannot find XXX
                      According to your posts, you are using Qt 5.15 for Android, so I would suggest to do it as follow:

                      CONFIG(release, debug|release): SSL_PATH = /home/john/openssl_test
                      else: SSL_PATH = /home/john/openssl_test/no-asm
                      
                      contains(ANDROID_TARGET_ARCH, armeabi-v7a) : SSL_PATH = $$SSL_PATH/Qt-5.12.4_5.13.0/arm
                      contains(ANDROID_TARGET_ARCH, arm64-v8a) : SSL_PATH = $$SSL_PATH/Qt-5.12.4_5.13.0/arm64
                      contains(ANDROID_TARGET_ARCH, x86): SSL_PATH = $$SSL_PATH/Qt-5.12.4_5.13.0/x86
                      contains(ANDROID_TARGET_ARCH, x86_64) : SSL_PATH = $$SSL_PATH/Qt-5.12.4_5.13.0/x86_64
                      
                      LIBS += -L$$SSL_PATH -llibcrypto
                      LIBS += -L$$SSL_PATH -llibssl
                      
                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on 29 Mar 2022, 06:25 last edited by
                      #11

                      @KroMignon said in Problem with include openssl on Qt Andrioid:

                      LIBS += -L$$SSL_PATH -llibcrypto
                      LIBS += -L$$SSL_PATH -llibssl

                      It should be

                      LIBS += -L$$SSL_PATH -lcrypto
                      LIBS += -L$$SSL_PATH -lssl
                      

                      (without lib prefix).
                      @Creatorczyk

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      K 1 Reply Last reply 29 Mar 2022, 06:26
                      1
                      • jsulmJ jsulm
                        29 Mar 2022, 06:25

                        @KroMignon said in Problem with include openssl on Qt Andrioid:

                        LIBS += -L$$SSL_PATH -llibcrypto
                        LIBS += -L$$SSL_PATH -llibssl

                        It should be

                        LIBS += -L$$SSL_PATH -lcrypto
                        LIBS += -L$$SSL_PATH -lssl
                        

                        (without lib prefix).
                        @Creatorczyk

                        K Offline
                        K Offline
                        KroMignon
                        wrote on 29 Mar 2022, 06:26 last edited by
                        #12

                        @jsulm said in Problem with include openssl on Qt Andrioid:

                        It should be
                        LIBS += -L$$SSL_PATH -lcrypto
                        LIBS += -L$$SSL_PATH -lssl

                        (without lib prefix).

                        Thanks :)

                        It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                        C 1 Reply Last reply 30 Mar 2022, 12:32
                        0
                        • K KroMignon
                          29 Mar 2022, 06:26

                          @jsulm said in Problem with include openssl on Qt Andrioid:

                          It should be
                          LIBS += -L$$SSL_PATH -lcrypto
                          LIBS += -L$$SSL_PATH -lssl

                          (without lib prefix).

                          Thanks :)

                          C Offline
                          C Offline
                          Creatorczyk
                          wrote on 30 Mar 2022, 12:32 last edited by
                          #13

                          @KroMignon @jsulm I was able to build a project thanks to your tips, but I am having trouble running the application on my phone now. During "Run" the application crashes and issues the following message:

                          30d838d8-112b-4326-9368-60e89dbf8c80-image.png

                          K 1 Reply Last reply 30 Mar 2022, 12:40
                          0
                          • C Creatorczyk
                            30 Mar 2022, 12:32

                            @KroMignon @jsulm I was able to build a project thanks to your tips, but I am having trouble running the application on my phone now. During "Run" the application crashes and issues the following message:

                            30d838d8-112b-4326-9368-60e89dbf8c80-image.png

                            K Offline
                            K Offline
                            KroMignon
                            wrote on 30 Mar 2022, 12:40 last edited by
                            #14

                            @Creatorczyk said in Problem with include openssl on Qt Andrioid:

                            was able to build a project thanks to your tips, but I am having trouble running the application on my phone now. During "Run" the application crashes and issues the following message:

                            This message means libcrypto.so is not included in you APK, which looks strange to me, because this should be done with include(c:/Android/android-sdk/android_openssl/openssl.pri).

                            As APK file is a ZIP archive, you could verify the openSSL libs are include.

                            You could also try to add them by adding following code in your PRO file:

                            ANDROID_EXTRA_LIBS += \
                                 $SSL_PATH/libcrypto.so \
                                 $SSL_PATH/libssl.so
                            

                            It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                            C 2 Replies Last reply 31 Mar 2022, 09:35
                            1
                            • K KroMignon
                              30 Mar 2022, 12:40

                              @Creatorczyk said in Problem with include openssl on Qt Andrioid:

                              was able to build a project thanks to your tips, but I am having trouble running the application on my phone now. During "Run" the application crashes and issues the following message:

                              This message means libcrypto.so is not included in you APK, which looks strange to me, because this should be done with include(c:/Android/android-sdk/android_openssl/openssl.pri).

                              As APK file is a ZIP archive, you could verify the openSSL libs are include.

                              You could also try to add them by adding following code in your PRO file:

                              ANDROID_EXTRA_LIBS += \
                                   $SSL_PATH/libcrypto.so \
                                   $SSL_PATH/libssl.so
                              
                              C Offline
                              C Offline
                              Creatorczyk
                              wrote on 31 Mar 2022, 09:35 last edited by
                              #15

                              @KroMignon said in Problem with include openssl on Qt Andrioid:

                              ANDROID_EXTRA_LIBS +=
                              $SSL_PATH/libcrypto.so
                              $SSL_PATH/libssl.so

                              I changed to

                              ANDROID_EXTRA_LIBS += \
                                   $$SSL_PATH/libcrypto.so \
                                   $$SSL_PATH/libssl.so
                              

                              And it works. Thanks!!

                              1 Reply Last reply
                              0
                              • K KroMignon
                                30 Mar 2022, 12:40

                                @Creatorczyk said in Problem with include openssl on Qt Andrioid:

                                was able to build a project thanks to your tips, but I am having trouble running the application on my phone now. During "Run" the application crashes and issues the following message:

                                This message means libcrypto.so is not included in you APK, which looks strange to me, because this should be done with include(c:/Android/android-sdk/android_openssl/openssl.pri).

                                As APK file is a ZIP archive, you could verify the openSSL libs are include.

                                You could also try to add them by adding following code in your PRO file:

                                ANDROID_EXTRA_LIBS += \
                                     $SSL_PATH/libcrypto.so \
                                     $SSL_PATH/libssl.so
                                
                                C Offline
                                C Offline
                                Creatorczyk
                                wrote on 7 Apr 2022, 11:37 last edited by Creatorczyk 4 Jul 2022, 11:38
                                #16

                                @KroMignon Hi, unfortunately I still have a problem. I've changed repository locations and want to run the project. Building is successful, but again there was a problem running the application on the phone:

                                My pro file:
                                703c40eb-c03a-471c-91f7-c0381f0e1de4-image.png

                                Application output:
                                43b54461-7326-4f06-ace3-576e176556ca-image.png

                                It is the same error as before, despite the added:
                                0f39f55a-3a26-429a-8590-377901a05ac5-image.png

                                The project in the old location works without any problems. It appeared while moving the repository to a different path. How could I fix it?

                                K 1 Reply Last reply 7 Apr 2022, 11:43
                                0
                                • C Creatorczyk
                                  7 Apr 2022, 11:37

                                  @KroMignon Hi, unfortunately I still have a problem. I've changed repository locations and want to run the project. Building is successful, but again there was a problem running the application on the phone:

                                  My pro file:
                                  703c40eb-c03a-471c-91f7-c0381f0e1de4-image.png

                                  Application output:
                                  43b54461-7326-4f06-ace3-576e176556ca-image.png

                                  It is the same error as before, despite the added:
                                  0f39f55a-3a26-429a-8590-377901a05ac5-image.png

                                  The project in the old location works without any problems. It appeared while moving the repository to a different path. How could I fix it?

                                  K Offline
                                  K Offline
                                  KroMignon
                                  wrote on 7 Apr 2022, 11:43 last edited by KroMignon 4 Jul 2022, 11:43
                                  #17

                                  @Creatorczyk said in Problem with include openssl on Qt Andrioid:

                                  The project in the old location works without any problems. It appeared while moving the repository to a different path. How could I fix it?

                                  The error you have is clear, the library libcrypto.so is not part of your APK, and cannot be found at application start.
                                  Are you sure SSL_PATH is what it should be?
                                  you could add message(SSL_PATH is $$SSL_PATH) to show what you have configured.

                                  It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                                  C 1 Reply Last reply 12 Apr 2022, 12:03
                                  0
                                  • K KroMignon
                                    7 Apr 2022, 11:43

                                    @Creatorczyk said in Problem with include openssl on Qt Andrioid:

                                    The project in the old location works without any problems. It appeared while moving the repository to a different path. How could I fix it?

                                    The error you have is clear, the library libcrypto.so is not part of your APK, and cannot be found at application start.
                                    Are you sure SSL_PATH is what it should be?
                                    you could add message(SSL_PATH is $$SSL_PATH) to show what you have configured.

                                    C Offline
                                    C Offline
                                    Creatorczyk
                                    wrote on 12 Apr 2022, 12:03 last edited by
                                    #18

                                    @KroMignon I resolved problem by check checkboxes in Build Steps with archictures. Thanks

                                    1 Reply Last reply
                                    0
                                    • K KroMignon
                                      28 Mar 2022, 11:48

                                      @Creatorczyk said in Problem with include openssl on Qt Andrioid:

                                      I use Qt 5.15.2, maybe it's couse of problem

                                      AFAIK, you have to install open ssl libs with help Qt Creator.
                                      In Tools / Options select Devices and go to tab Android
                                      There you will find a button called "Download OpenSSL"
                                      f6e14480-17d4-4e45-98da-a5f70b05a637-image.png

                                      [EDIT]: After that you have to include the libs in your PRO / CMakeLists.txt file as explained here: https://doc.qt.io/qt-5/android-openssl-support.html#using-openssl-libraries-with-qt-for-android

                                      In my case it would be

                                      • for qmake:
                                      android: include(c:/Android/android-sdk/android_openssl/openssl.pri)
                                      
                                      • for cmake:
                                      if (ANDROID)
                                          include(c:/Android/android-sdk/android_openssl/CMakeLists.txt)
                                      endif()
                                      
                                      8 Offline
                                      8 Offline
                                      8Observer8
                                      wrote on 8 May 2024, 09:39 last edited by 8Observer8 5 Aug 2024, 09:43
                                      #19

                                      @KroMignon said in Problem with include openssl on Qt Andrioid:

                                      for qmake

                                      Thank you very much!

                                      63fc71f4-e8f5-4dde-a1e3-a7d25fcd37a9-image.png

                                      QT += core gui websockets widgets
                                      
                                      android: include(C:/Qt/Tools/OpenSSL-1.1.1j/Win_x64/bin/openssl.pri)
                                      
                                      CONFIG += c++17
                                      
                                      SOURCES += \
                                          main.cpp
                                      

                                      I have deployed a simple server example with Box2D-WASM in JavaScript on free Glitch hosting: https://glitch.com/edit/#!/merciful-regal-soursop from the GitHub repository: send-gravity-from-server-to-client-box2d-wasm-js This example sends the gravity value in JSON format when a client is connected. The following example is a client that works on Android, Desktop, and Web (with Qt WebAssembly). It is useful example to make multiplayer games with physics on the server side:

                                      Output:

                                      connected
                                      "{\"action\":\"scGravity\",\"data\":\"{\\\"x\\\":0,\\\"y\\\":-3}\"}"
                                      

                                      main.cpp

                                      #include <QtNetwork/QNetworkRequest>
                                      #include <QtWebSockets/QWebSocket>
                                      #include <QtWidgets/QApplication>
                                      #include <QtWidgets/QWidget>
                                      
                                      class Widget : public QWidget
                                      {
                                          Q_OBJECT
                                      
                                      public:
                                      
                                          Widget()
                                          {
                                              setWindowTitle("Show gravity from server with Box2D-WASM");
                                              resize(420, 200);
                                      
                                              connect(&m_webSocket, &QWebSocket::connected,
                                                  this, &Widget::onConnected);
                                              connect(&m_webSocket, &QWebSocket::textMessageReceived,
                                                  this, &Widget::onMessageReceived);
                                              connect(&m_webSocket, &QWebSocket::errorOccurred,
                                                  this, &Widget::onErrorOccurred);
                                      
                                              QUrl url("wss://merciful-regal-soursop.glitch.me");
                                      
                                              QNetworkRequest request;
                                              request.setUrl(url);
                                              request.setRawHeader(QByteArray("User-Agent"), QByteArray("Mozilla/5.0 "
                                                  "(Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
                                                  "Chrome/124.0.0.0 Safari/537.36"));
                                      
                                              m_webSocket.open(request);
                                          }
                                          ~Widget() {}
                                      
                                      private slots:
                                      
                                          void onConnected()
                                          {
                                              qDebug() << "connected";
                                          }
                                          void onMessageReceived(const QString &message)
                                          {
                                              qDebug() << message;
                                          }
                                      
                                          void onErrorOccurred(QAbstractSocket::SocketError error)
                                          {
                                              qDebug() << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
                                              qDebug() << "Error:" << error;
                                              qDebug() << "Device supports OpenSSL:" << QSslSocket::supportsSsl();
                                              qDebug() << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
                                          }
                                      
                                      private:
                                      
                                          QWebSocket m_webSocket;
                                      };
                                      
                                      #include "main.moc"
                                      
                                      int main(int argc, char *argv[])
                                      {
                                          QApplication a(argc, argv);
                                          Widget w;
                                          w.show();
                                          return a.exec();
                                      }
                                      
                                      1 Reply Last reply
                                      0

                                      • Login

                                      • Login or register to search.
                                      • First post
                                        Last post
                                      0
                                      • Categories
                                      • Recent
                                      • Tags
                                      • Popular
                                      • Users
                                      • Groups
                                      • Search
                                      • Get Qt Extensions
                                      • Unsolved