Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Using google protobuf with Qt Creator
QtWS25 Last Chance

Using google protobuf with Qt Creator

Scheduled Pinned Locked Moved 3rd Party Software
25 Posts 5 Posters 18.3k 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.
  • S Offline
    S Offline
    SGaist
    Lifetime Qt Champion
    wrote on 5 Jan 2014, 21:25 last edited by
    #2

    Hi,

    Just a wild guess, are you using compatible compilers for all builds ?

    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
    • B Offline
      B Offline
      blah900
      wrote on 6 Jan 2014, 00:11 last edited by
      #3

      Wow, that worked!

      Once things have been compiled into an .exe, I don't need to carry around the protobuf library since it's static library right?

      V 1 Reply Last reply 22 Dec 2022, 08:06
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 6 Jan 2014, 08:18 last edited by
        #4

        That's correct yes

        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
        • B blah900
          6 Jan 2014, 00:11

          Wow, that worked!

          Once things have been compiled into an .exe, I don't need to carry around the protobuf library since it's static library right?

          V Offline
          V Offline
          VimHar
          wrote on 22 Dec 2022, 08:06 last edited by
          #5

          @blah900 hey. What have you done that made things work. I have installed protobuf using vcpkg and pointing to the static library same as you did in windows.

          Except lptotobuf im using llibprotouf. Still facing the undefined erro.

          J 1 Reply Last reply 22 Dec 2022, 08:09
          0
          • V VimHar
            22 Dec 2022, 08:06

            @blah900 hey. What have you done that made things work. I have installed protobuf using vcpkg and pointing to the static library same as you did in windows.

            Except lptotobuf im using llibprotouf. Still facing the undefined erro.

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 22 Dec 2022, 08:09 last edited by
            #6

            @VimHar said in Using google protobuf with Qt Creator:

            Except lptotobuf im using llibprotouf

            How do you link libprotobuf?

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

            V 1 Reply Last reply 22 Dec 2022, 09:10
            0
            • J jsulm
              22 Dec 2022, 08:09

              @VimHar said in Using google protobuf with Qt Creator:

              Except lptotobuf im using llibprotouf

              How do you link libprotobuf?

              V Offline
              V Offline
              VimHar
              wrote on 22 Dec 2022, 09:10 last edited by
              #7

              @jsulm

              LIBS += -LC:/vcpkg/installed/x64-windows/lib/ -llibprotobuf

              like this

              J 1 Reply Last reply 22 Dec 2022, 09:12
              0
              • V VimHar
                22 Dec 2022, 09:10

                @jsulm

                LIBS += -LC:/vcpkg/installed/x64-windows/lib/ -llibprotobuf

                like this

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 22 Dec 2022, 09:12 last edited by
                #8

                @VimHar said in Using google protobuf with Qt Creator:

                -llibprotobuf

                -lprotobuf
                

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

                V 1 Reply Last reply 22 Dec 2022, 09:23
                0
                • J jsulm
                  22 Dec 2022, 09:12

                  @VimHar said in Using google protobuf with Qt Creator:

                  -llibprotobuf

                  -lprotobuf
                  
                  V Offline
                  V Offline
                  VimHar
                  wrote on 22 Dec 2022, 09:23 last edited by VimHar
                  #9

                  @jsulm Have done that. It says
                  :-1: error: cannot find -lprotobuf

                  My files in lib folder are libprotobuf.lib , libprotobuf-lite.lib , libprotoc.lib

                  J 1 Reply Last reply 22 Dec 2022, 09:28
                  0
                  • V VimHar
                    22 Dec 2022, 09:23

                    @jsulm Have done that. It says
                    :-1: error: cannot find -lprotobuf

                    My files in lib folder are libprotobuf.lib , libprotobuf-lite.lib , libprotoc.lib

                    J Offline
                    J Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on 22 Dec 2022, 09:28 last edited by
                    #10

                    @VimHar On windows you need libprotobuf.lib to link at build time - do you have it?

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

                    V 1 Reply Last reply 22 Dec 2022, 09:35
                    0
                    • J jsulm
                      22 Dec 2022, 09:28

                      @VimHar On windows you need libprotobuf.lib to link at build time - do you have it?

                      V Offline
                      V Offline
                      VimHar
                      wrote on 22 Dec 2022, 09:35 last edited by VimHar
                      #11

                      @jsulm Yes as stated I have these files in lib folder of the path specified,
                      libprotobuf.lib , libprotobuf-lite.lib , libprotoc.lib

                      My .pro file

                      QT += core gui

                      greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

                      CONFIG += c++17

                      INCLUDEPATH += C:\vcpkg\installed\x64-windows\include\

                      LIBS += -LC:/vcpkg/installed/x64-windows/lib/ -lprotobuf

                      SOURCES +=
                      main.cpp
                      mainwindow.cpp
                      m.pb.cc

                      HEADERS +=
                      mainwindow.h
                      m.pb.h

                      FORMS +=
                      mainwindow.ui

                      J 1 Reply Last reply 22 Dec 2022, 09:51
                      0
                      • V VimHar
                        22 Dec 2022, 09:35

                        @jsulm Yes as stated I have these files in lib folder of the path specified,
                        libprotobuf.lib , libprotobuf-lite.lib , libprotoc.lib

                        My .pro file

                        QT += core gui

                        greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

                        CONFIG += c++17

                        INCLUDEPATH += C:\vcpkg\installed\x64-windows\include\

                        LIBS += -LC:/vcpkg/installed/x64-windows/lib/ -lprotobuf

                        SOURCES +=
                        main.cpp
                        mainwindow.cpp
                        m.pb.cc

                        HEADERS +=
                        mainwindow.h
                        m.pb.h

                        FORMS +=
                        mainwindow.ui

                        J Offline
                        J Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on 22 Dec 2022, 09:51 last edited by
                        #12

                        @VimHar said in Using google protobuf with Qt Creator:

                        -lprotobuf

                        Try

                        -llibprotobuf.lib
                        

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

                        V 1 Reply Last reply 22 Dec 2022, 14:56
                        0
                        • J jsulm
                          22 Dec 2022, 09:51

                          @VimHar said in Using google protobuf with Qt Creator:

                          -lprotobuf

                          Try

                          -llibprotobuf.lib
                          
                          V Offline
                          V Offline
                          VimHar
                          wrote on 22 Dec 2022, 14:56 last edited by
                          #13

                          @jsulm No same error. Cannot find llibprotouf.lib

                          JonBJ 1 Reply Last reply 22 Dec 2022, 18:47
                          0
                          • V VimHar
                            22 Dec 2022, 14:56

                            @jsulm No same error. Cannot find llibprotouf.lib

                            JonBJ Offline
                            JonBJ Offline
                            JonB
                            wrote on 22 Dec 2022, 18:47 last edited by
                            #14

                            @VimHar
                            There have been inconsistencies in the spellings of what you have typed in your various posts. Why don't you try:

                            LIBS += C:\vcpkg\installed\x64-windows\lib\libprotobuf.lib
                            

                            Please use copy & paste of above line. If you get error please copy & paste exact text back here.

                            V 1 Reply Last reply 23 Dec 2022, 07:23
                            0
                            • JonBJ JonB
                              22 Dec 2022, 18:47

                              @VimHar
                              There have been inconsistencies in the spellings of what you have typed in your various posts. Why don't you try:

                              LIBS += C:\vcpkg\installed\x64-windows\lib\libprotobuf.lib
                              

                              Please use copy & paste of above line. If you get error please copy & paste exact text back here.

                              V Offline
                              V Offline
                              VimHar
                              wrote on 23 Dec 2022, 07:23 last edited by
                              #15

                              @JonB said in Using google protobuf with Qt Creator:

                              LIBS += C:\vcpkg\installed\x64-windows\lib\libprotobuf.lib

                              QT += core gui

                              greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

                              CONFIG += c++17

                              INCLUDEPATH += C:\vcpkg\installed\x64-windows\include\

                              LIBS += C:\vcpkg\installed\x64-windows\lib\libprotobuf.lib

                              SOURCES +=
                              main.cpp
                              mainwindow.cpp
                              m.pb.cc

                              HEADERS +=
                              mainwindow.h
                              m.pb.h

                              FORMS +=
                              mainwindow.ui

                              Sorry for the same. Even then Im getting the same undefined error faced by the actual questioner.
                              i.e "undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const*, bool)''

                              J JonBJ 2 Replies Last reply 23 Dec 2022, 07:50
                              0
                              • V VimHar
                                23 Dec 2022, 07:23

                                @JonB said in Using google protobuf with Qt Creator:

                                LIBS += C:\vcpkg\installed\x64-windows\lib\libprotobuf.lib

                                QT += core gui

                                greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

                                CONFIG += c++17

                                INCLUDEPATH += C:\vcpkg\installed\x64-windows\include\

                                LIBS += C:\vcpkg\installed\x64-windows\lib\libprotobuf.lib

                                SOURCES +=
                                main.cpp
                                mainwindow.cpp
                                m.pb.cc

                                HEADERS +=
                                mainwindow.h
                                m.pb.h

                                FORMS +=
                                mainwindow.ui

                                Sorry for the same. Even then Im getting the same undefined error faced by the actual questioner.
                                i.e "undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const*, bool)''

                                J Offline
                                J Offline
                                jsulm
                                Lifetime Qt Champion
                                wrote on 23 Dec 2022, 07:50 last edited by
                                #16

                                @VimHar Was the Protobuf lib built using same compiler? What compiler do you use to build your app?

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

                                1 Reply Last reply
                                0
                                • V VimHar
                                  23 Dec 2022, 07:23

                                  @JonB said in Using google protobuf with Qt Creator:

                                  LIBS += C:\vcpkg\installed\x64-windows\lib\libprotobuf.lib

                                  QT += core gui

                                  greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

                                  CONFIG += c++17

                                  INCLUDEPATH += C:\vcpkg\installed\x64-windows\include\

                                  LIBS += C:\vcpkg\installed\x64-windows\lib\libprotobuf.lib

                                  SOURCES +=
                                  main.cpp
                                  mainwindow.cpp
                                  m.pb.cc

                                  HEADERS +=
                                  mainwindow.h
                                  m.pb.h

                                  FORMS +=
                                  mainwindow.ui

                                  Sorry for the same. Even then Im getting the same undefined error faced by the actual questioner.
                                  i.e "undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const*, bool)''

                                  JonBJ Offline
                                  JonBJ Offline
                                  JonB
                                  wrote on 23 Dec 2022, 08:59 last edited by JonB
                                  #17

                                  @VimHar said in Using google protobuf with Qt Creator:

                                  Even then Im getting the same undefined error faced by the actual questioner.
                                  i.e "undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const*, bool)''

                                  Now I do not understand, because this is not the same error at all as you said you were having. You said you got one of:

                                  . :-1: error: cannot find -lprotobuf
                                  Cannot find llibprotouf.lib

                                  These errors mean it could not find the library file to link with --- which is why I wanted to get you to type in the full path --- where the error now is that the library file is found, but you have an unresolved reference. Quite different kinds of error.

                                  I think/suspect the lib file is being found but is the wrong version or built with the wrong compiler or something like that.... Please start by answering @jsulm's question with your best information.

                                  V 1 Reply Last reply 23 Dec 2022, 09:16
                                  1
                                  • JonBJ JonB
                                    23 Dec 2022, 08:59

                                    @VimHar said in Using google protobuf with Qt Creator:

                                    Even then Im getting the same undefined error faced by the actual questioner.
                                    i.e "undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const*, bool)''

                                    Now I do not understand, because this is not the same error at all as you said you were having. You said you got one of:

                                    . :-1: error: cannot find -lprotobuf
                                    Cannot find llibprotouf.lib

                                    These errors mean it could not find the library file to link with --- which is why I wanted to get you to type in the full path --- where the error now is that the library file is found, but you have an unresolved reference. Quite different kinds of error.

                                    I think/suspect the lib file is being found but is the wrong version or built with the wrong compiler or something like that.... Please start by answering @jsulm's question with your best information.

                                    V Offline
                                    V Offline
                                    VimHar
                                    wrote on 23 Dec 2022, 09:16 last edited by VimHar
                                    #18

                                    hey Thanks..JonB.. The actual intention of mine is the "undefined error" only.
                                    Regarding compilers, I used vcpkg for installing protobuf and Qt uses MinGw64.

                                    Is this the problem??

                                    J JonBJ 2 Replies Last reply 23 Dec 2022, 09:18
                                    0
                                    • V VimHar
                                      23 Dec 2022, 09:16

                                      hey Thanks..JonB.. The actual intention of mine is the "undefined error" only.
                                      Regarding compilers, I used vcpkg for installing protobuf and Qt uses MinGw64.

                                      Is this the problem??

                                      J Offline
                                      J Offline
                                      jsulm
                                      Lifetime Qt Champion
                                      wrote on 23 Dec 2022, 09:18 last edited by
                                      #19

                                      @VimHar said in Using google protobuf with Qt Creator:

                                      Is this the problem??

                                      Probably.
                                      There should be a linker warning in the build log.

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

                                      1 Reply Last reply
                                      1
                                      • V VimHar
                                        23 Dec 2022, 09:16

                                        hey Thanks..JonB.. The actual intention of mine is the "undefined error" only.
                                        Regarding compilers, I used vcpkg for installing protobuf and Qt uses MinGw64.

                                        Is this the problem??

                                        JonBJ Offline
                                        JonBJ Offline
                                        JonB
                                        wrote on 23 Dec 2022, 09:27 last edited by
                                        #20

                                        @VimHar said in Using google protobuf with Qt Creator:

                                        I used vcpkg for installing protobuf and Qt uses MinGw64.

                                        I don't know what "vcpkg" is (MSVC??) but it sounds like a different compiler/linker. MinGW library files end in .a not .lib, maybe that is the cause of the "cannot find library" messages? In any case you need to use the smae compiler/linker for everything.

                                        1 Reply Last reply
                                        1
                                        • V Offline
                                          V Offline
                                          VimHar
                                          wrote on 23 Dec 2022, 10:40 last edited by VimHar
                                          #21

                                          Hey,.. Great. I have done re-installing protobuf using Msys following the steps below
                                          https://stackoverflow.com/a/73287395/10432503

                                          Now I can able to run using plain g++ command in the terminal.

                                          But when I do the same in QT , the following error occurs
                                          :-1: error: Dwarf Error: Can't find .debug_ranges section.

                                          My .pro file
                                          QT += core gui

                                          greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

                                          CONFIG += c++17

                                          INCLUDEPATH += C:/protobuf-3.21.11/src

                                          LIBS += -LC:/protobuf-3.21.11/src/.libs -lprotobuf

                                          SOURCES +=
                                          main.cpp
                                          mainwindow.cpp
                                          m.pb.cc

                                          HEADERS +=
                                          mainwindow.h
                                          m.pb.h

                                          FORMS +=
                                          mainwindow.ui

                                          Should I add anything more.?

                                          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