Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. https://github.com/qt/qtcloudmessaging example does not compile
QtWS25 Last Chance

https://github.com/qt/qtcloudmessaging example does not compile

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
33 Posts 5 Posters 3.0k Views
  • 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.
  • I Offline
    I Offline
    Ilnur
    wrote on last edited by
    #1

    I want to receive push notification from firebase, so took qt/qtCloudMessaging module, installed it, included in .pro file:

    QT += quick quickcontrols2 websockets cloudmessagingfirebase cloudmessaging
    

    and tried to run example code in README
    The problems is on this lines:

    #include <QCloudMessaging>
    #include <QCloudMessagingFirebaseProvider
    ...
    int main() {
      QCloudMessaging *pushServices = new QCloudMessaging();
    
      //***** OR For Firebase mobile systems:
      QCloudMessagingFirebaseProvider *m_firebaseService = new QCloudMessagingFirebaseProvider();
    
      QVariantMap provider_params;
      provider_params["SERVER_API_KEY"] = "Get your SERVER API KEY from the google firebase console";
      pushServices->registerProvider("GoogleFireBase", m_firebaseService, provider_params);
    
      return 0;
    }
    

    with such error:

    ...../main.cpp:43: error: cannot initialize a parameter of type 'QCloudMessagingProvider *' with an lvalue of type 'QCloudMessagingFirebaseProvider *'
    

    by the time in qcloudmessagin.h we have definition of this method:

        Q_INVOKABLE bool registerProvider(const QString &providerId,
                                          QCloudMessagingProvider *provider,
                                          const QVariantMap &parameters = QVariantMap());
    

    so, as second parameter method wants to take QCloudMessagingProvider, but got QCloudMessagingFirebaseProvider, which inherits QCloudMessagingProvider
    How to solve this problem?
    I know, that I am not expert in C++, may be its pretty easy to solve...

    sierdzioS 1 Reply Last reply
    0
    • I Ilnur

      I want to receive push notification from firebase, so took qt/qtCloudMessaging module, installed it, included in .pro file:

      QT += quick quickcontrols2 websockets cloudmessagingfirebase cloudmessaging
      

      and tried to run example code in README
      The problems is on this lines:

      #include <QCloudMessaging>
      #include <QCloudMessagingFirebaseProvider
      ...
      int main() {
        QCloudMessaging *pushServices = new QCloudMessaging();
      
        //***** OR For Firebase mobile systems:
        QCloudMessagingFirebaseProvider *m_firebaseService = new QCloudMessagingFirebaseProvider();
      
        QVariantMap provider_params;
        provider_params["SERVER_API_KEY"] = "Get your SERVER API KEY from the google firebase console";
        pushServices->registerProvider("GoogleFireBase", m_firebaseService, provider_params);
      
        return 0;
      }
      

      with such error:

      ...../main.cpp:43: error: cannot initialize a parameter of type 'QCloudMessagingProvider *' with an lvalue of type 'QCloudMessagingFirebaseProvider *'
      

      by the time in qcloudmessagin.h we have definition of this method:

          Q_INVOKABLE bool registerProvider(const QString &providerId,
                                            QCloudMessagingProvider *provider,
                                            const QVariantMap &parameters = QVariantMap());
      

      so, as second parameter method wants to take QCloudMessagingProvider, but got QCloudMessagingFirebaseProvider, which inherits QCloudMessagingProvider
      How to solve this problem?
      I know, that I am not expert in C++, may be its pretty easy to solve...

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      @Ilnur said in https://github.com/qt/qtcloudmessaging example does not compile:

      which inherits QCloudMessagingProvider

      Are you sure? Can your show header and constructor implementation of QCloudMessagingFirebaseProvider?

      (Z(:^

      I 1 Reply Last reply
      2
      • sierdzioS sierdzio

        @Ilnur said in https://github.com/qt/qtcloudmessaging example does not compile:

        which inherits QCloudMessagingProvider

        Are you sure? Can your show header and constructor implementation of QCloudMessagingFirebaseProvider?

        I Offline
        I Offline
        Ilnur
        wrote on last edited by Ilnur
        #3

        @sierdzio
        https://github.com/qt/qtcloudmessaging/blob/master/src/cloudmessaging/qcloudmessaging.h#L58
        that is header file

        about inherits
        https://github.com/qt/qtcloudmessaging/blob/master/src/cloudmessagingfirebase/qcloudmessagingfirebaseprovider.h#L47

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          OK code looks good, no idea why it does not work.

          (Z(:^

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            What compiler are you using ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            I 1 Reply Last reply
            0
            • SGaistS SGaist

              Hi,

              What compiler are you using ?

              I Offline
              I Offline
              Ilnur
              wrote on last edited by
              #6

              @SGaist 0_1554472706038_0cf7f641-1a60-4e4a-8601-a3db9991be3e-image.png

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                That doesn't fully answer the question. What version of gcc are you using ?
                Are you using Qt Creator to build the module ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                I 1 Reply Last reply
                1
                • I Offline
                  I Offline
                  Ilnur
                  wrote on last edited by Ilnur
                  #8

                  0_1554473149265_78d1d256-334c-4efb-a62b-0cde8a300a16-image.png
                  here I also have one more problem, firebase/app.h not found
                  May be I installed module incorrectly?
                  What I did:

                  /qt_dir/path_to_android_qmake/qmake CONFIG+=firebase
                  make
                  sudo make install
                  

                  0_1554473367906_e7f7b869-a067-4e6b-9120-f10c82ad265b-image.png

                  Qt 5.12.1 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.3.1 20160406 (Red Hat 5.3.1-6)) on "xcb"
                  OS: Ubuntu 18.04.2 LTS [linux version 4.15.0-47-generic]

                  Architecture: x86_64; features: SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 AVX AVX2

                  clang++ --version:

                  /home/ilnur/Android/android-ndk-r18b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --version
                  Android (4751641 based on r328903) clang version 7.0.2 (https://android.googlesource.com/toolchain/clang 003100370607242ddd5815e4a043907ea9004281) (https://android.googlesource.com/toolchain/llvm 1d739ffb0366421d383e04ff80ec2ee591315116) (based on LLVM 7.0.2svn)
                  Target: x86_64-unknown-linux-gnu
                  Thread model: posix
                  InstalledDir: /home/ilnur/Android/android-ndk-r18b/toolchains/llvm/prebuilt/linux-x86_64/bin
                  
                  1 Reply Last reply
                  0
                  • SGaistS SGaist

                    That doesn't fully answer the question. What version of gcc are you using ?
                    Are you using Qt Creator to build the module ?

                    I Offline
                    I Offline
                    Ilnur
                    wrote on last edited by
                    #9

                    @SGaist said in https://github.com/qt/qtcloudmessaging example does not compile:

                    Are you using Qt Creator to build the module ?

                    no, I built via terminal

                    qmake CONFIG+=firebase
                    make
                    sudo make install
                    
                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      Might be a silly question but did you install the firebase SDK ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      2
                      • R Offline
                        R Offline
                        Robin Hood
                        wrote on last edited by
                        #11

                        Hello, I would like to start the qtcloudmessaging example!
                        I followed the instructions on qtcloudmessaging-examples
                        Can you help me with this?

                        This is the error "Project ERROR: Unknown module(s) in QT: cloudmessagingfirebase"

                        `cd firebase\ && ( if not exist Makefile D:\Qt\5.12.5\mingw73_64\bin\qmake.exe -o Makefile C:\Users\rjung\Desktop\Beispiel-Projekte\Push-Projekte\qtcloudmessaging-examples-master\firebase\firebase.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug" "CONFIG += firebase" ) && D:/Qt/Tools/mingw730_64/bin/mingw32-make -f Makefile clean
                        mingw32-make[1]: Entering directory 'C:/Users/rjung/Desktop/Beispiel-Projekte/Push-Projekte/build-cloudmessaging-Desktop_Qt_5_12_5_MinGW_64_bit-Debug/firebase'
                        cd QtCloudMessagingFirebaseChat\ && ( if not exist Makefile D:\Qt\5.12.5\mingw73_64\bin\qmake.exe -o Makefile C:\Users\rjung\Desktop\Beispiel-Projekte\Push-Projekte\qtcloudmessaging-examples-master\firebase\QtCloudMessagingFirebaseChat\QtCloudMessagingFirebaseChat.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug" "CONFIG += firebase" ) && D:/Qt/Tools/mingw730_64/bin/mingw32-make -f Makefile clean
                        Project ERROR: Unknown module(s) in QT: cloudmessagingfirebase
                        mingw32-make[1]: *** [Makefile:55: sub-QtCloudMessagingFirebaseChat-clean-ordered] Error 3
                        mingw32-make[1]: Leaving directory 'C:/Users/rjung/Desktop/Beispiel-Projekte/Push-Projekte/build-cloudmessaging-Desktop_Qt_5_12_5_MinGW_64_bit-Debug/firebase'
                        mingw32-make: *** [Makefile:55: sub-firebase-clean-ordered] Error 2
                        18:43:30: Der Prozess "D:\Qt\Tools\mingw730_64\bin\mingw32-make.exe" wurde mit dem Rückgabewert 2 beendet.
                        

                        Before I add this in qmake:
                        "CONFIG += firebase"

                        Because I am not allowed to set my environment variables, I added the path for GOOGLE_FIREBASE_SDK in .pro file:
                        GOOGLE_FIREBASE_SDK = <Path_to_Firebase_SDK>

                        isEmpty(ENV_FIREBASE_SDK) {
                        ENV_FIREBASE_SDK = $${GOOGLE_FIREBASE_SDK}
                        ...

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          Hi,

                          Did you build the module itself ? With firebase support ?

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • R Offline
                            R Offline
                            Robin Hood
                            wrote on last edited by
                            #13
                            This post is deleted!
                            1 Reply Last reply
                            0
                            • R Offline
                              R Offline
                              Robin Hood
                              wrote on last edited by
                              #14

                              So i've been building a firebase project under firebase console.
                              I downloaded the qt project from git (https://github.com/snowgrains/qtcloudmessaging-examples) and followed the instructions. Basically i just changed some paths and added the google-service.json ...

                              But I think I must have forgotten something in the front if qt does not recognize the module.

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #15

                                Hence my question: did you build that Qt module ?

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                1 Reply Last reply
                                0
                                • R Offline
                                  R Offline
                                  Robin Hood
                                  wrote on last edited by
                                  #16

                                  I don't know...
                                  How would you build Qt modules?

                                  1 Reply Last reply
                                  0
                                  • R Offline
                                    R Offline
                                    Robin Hood
                                    wrote on last edited by
                                    #17

                                    I think ...
                                    In the manual (https://github.com/snowgrains/qtcloudmessaging-examples) I did it until step 3. Step 4 is not applicable for me, because I only want to use firebase.

                                    But step 5 does not work. I think this is the problem, which is why he doesn't know the module.

                                    Step 5 is:
                                    Install first the QtCloudMessagingfrom command line with:
                                    qmake "CONFIG += embedded-kaltiot firebase" make make install

                                    I tried that, but the command does not work on my Windows computer.

                                    C:\Users\...\Desktop\Beispiel-Projekte\Push-Projekte\qtcloudmessaging-examples-master>qmake "CONFIG += embedded-kaltiot firebase" make make install
                                    Der Befehl "qmake" ist entweder falsch geschrieben oder
                                    konnte nicht gefunden werden.
                                    

                                    Afterwards I tried it like in the Qt Creator ...

                                    C:\Users\...\Desktop\Beispiel-Projekte\Push-Projekte\qtcloudmessaging-examples-master>D:\Qt\5.12.5\mingw73_64\bin\qmake.exe C:\Users\...\Desktop\Beispiel-Projekte\Push-Projekte\qtcloudmessaging-examples-master\cloudmessaging.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug" "CONFIG += embedded-kaltiot firebase" && D:/Qt/Tools/mingw730_64/bin/mingw32-make.exe qmake_all
                                    Info: creating stash file C:\Users\...\Desktop\Beispiel-Projekte\Push-Projekte\qtcloudmessaging-examples-master\.qmake.stash
                                    Project ERROR: Cannot run compiler 'g++'. Output:
                                    ===================
                                    ===================
                                    Maybe you forgot to setup the environment?
                                    
                                    jsulmJ 1 Reply Last reply
                                    0
                                    • R Robin Hood

                                      I think ...
                                      In the manual (https://github.com/snowgrains/qtcloudmessaging-examples) I did it until step 3. Step 4 is not applicable for me, because I only want to use firebase.

                                      But step 5 does not work. I think this is the problem, which is why he doesn't know the module.

                                      Step 5 is:
                                      Install first the QtCloudMessagingfrom command line with:
                                      qmake "CONFIG += embedded-kaltiot firebase" make make install

                                      I tried that, but the command does not work on my Windows computer.

                                      C:\Users\...\Desktop\Beispiel-Projekte\Push-Projekte\qtcloudmessaging-examples-master>qmake "CONFIG += embedded-kaltiot firebase" make make install
                                      Der Befehl "qmake" ist entweder falsch geschrieben oder
                                      konnte nicht gefunden werden.
                                      

                                      Afterwards I tried it like in the Qt Creator ...

                                      C:\Users\...\Desktop\Beispiel-Projekte\Push-Projekte\qtcloudmessaging-examples-master>D:\Qt\5.12.5\mingw73_64\bin\qmake.exe C:\Users\...\Desktop\Beispiel-Projekte\Push-Projekte\qtcloudmessaging-examples-master\cloudmessaging.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug" "CONFIG += embedded-kaltiot firebase" && D:/Qt/Tools/mingw730_64/bin/mingw32-make.exe qmake_all
                                      Info: creating stash file C:\Users\...\Desktop\Beispiel-Projekte\Push-Projekte\qtcloudmessaging-examples-master\.qmake.stash
                                      Project ERROR: Cannot run compiler 'g++'. Output:
                                      ===================
                                      ===================
                                      Maybe you forgot to setup the environment?
                                      
                                      jsulmJ Offline
                                      jsulmJ Offline
                                      jsulm
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #18

                                      @Robin-Hood Use the qtenv2.bat script from your MinGW installation to set up the environment properly.

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

                                      1 Reply Last reply
                                      0
                                      • R Offline
                                        R Offline
                                        Robin Hood
                                        wrote on last edited by
                                        #19

                                        @jsulm said in https://github.com/qt/qtcloudmessaging example does not compile:

                                        Use the qtenv2.bat script from your MinGW installation to set up the environment properly.

                                        I changed this file

                                        @echo off
                                        echo Setting up environment for Qt usage...
                                        set PATH=D:\Qt\5.12.5\mingw73_64\bin;D:/Qt/Tools/mingw730_64\bin;%PATH%
                                        set GOOGLE_FIREBASE_SDK=C:\Users\name\firebase_cpp_sdk_6.14.0\firebase_cpp_sdk
                                        cd /D D:\Qt\5.12.5\mingw73_64
                                        

                                        I still get the error message on the console

                                        C:\Users\...\Desktop\Beispiel-Projekte\Push-Projekte\qtcloudmessaging-examples-master>D:\Qt\5.12.5\mingw73_64\bin\qmake.exe C:\Users\...\Desktop\Beispiel-Projekte\Push-Projekte\qtcloudmessaging-examples-master\cloudmessaging.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug" "CONFIG += embedded-kaltiot firebase" && D:/Qt/Tools/mingw730_64/bin/mingw32-make.exe qmake_all
                                        Info: creating stash file C:\Users\...\Desktop\Beispiel-Projekte\Push-Projekte\qtcloudmessaging-examples-master\.qmake.stash
                                        Project ERROR: Cannot run compiler 'g++'. Output:
                                        ===================
                                        ===================
                                        Maybe you forgot to setup the environment?
                                        

                                        as well as in qt-creator

                                        "Project ERROR: Unknown module(s) in QT: cloudmessagingfirebase"
                                        
                                        jsulmJ 1 Reply Last reply
                                        0
                                        • R Robin Hood

                                          @jsulm said in https://github.com/qt/qtcloudmessaging example does not compile:

                                          Use the qtenv2.bat script from your MinGW installation to set up the environment properly.

                                          I changed this file

                                          @echo off
                                          echo Setting up environment for Qt usage...
                                          set PATH=D:\Qt\5.12.5\mingw73_64\bin;D:/Qt/Tools/mingw730_64\bin;%PATH%
                                          set GOOGLE_FIREBASE_SDK=C:\Users\name\firebase_cpp_sdk_6.14.0\firebase_cpp_sdk
                                          cd /D D:\Qt\5.12.5\mingw73_64
                                          

                                          I still get the error message on the console

                                          C:\Users\...\Desktop\Beispiel-Projekte\Push-Projekte\qtcloudmessaging-examples-master>D:\Qt\5.12.5\mingw73_64\bin\qmake.exe C:\Users\...\Desktop\Beispiel-Projekte\Push-Projekte\qtcloudmessaging-examples-master\cloudmessaging.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug" "CONFIG += embedded-kaltiot firebase" && D:/Qt/Tools/mingw730_64/bin/mingw32-make.exe qmake_all
                                          Info: creating stash file C:\Users\...\Desktop\Beispiel-Projekte\Push-Projekte\qtcloudmessaging-examples-master\.qmake.stash
                                          Project ERROR: Cannot run compiler 'g++'. Output:
                                          ===================
                                          ===================
                                          Maybe you forgot to setup the environment?
                                          

                                          as well as in qt-creator

                                          "Project ERROR: Unknown module(s) in QT: cloudmessagingfirebase"
                                          
                                          jsulmJ Offline
                                          jsulmJ Offline
                                          jsulm
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #20

                                          @Robin-Hood said in https://github.com/qt/qtcloudmessaging example does not compile:

                                          I changed this file

                                          Why? There is no need to change this file.
                                          And did you execute that file?
                                          As you can see it still fails to find the compiler.

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

                                          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