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. error LNK2001: unresolved external symbol "public: static struct QMetaObject .. from lib template
Forum Updated to NodeBB v4.3 + New Features

error LNK2001: unresolved external symbol "public: static struct QMetaObject .. from lib template

Scheduled Pinned Locked Moved Solved General and Desktop
28 Posts 5 Posters 10.9k Views 2 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.
  • O Offline
    O Offline
    OPit
    wrote on 8 Jan 2019, 10:55 last edited by
    #13

    @SGaist said in error LNK2001: unresolved external symbol "public: static struct QMetaObject .. from lib template:

    silly

    Sadly it's not the problem ...

    A 1 Reply Last reply 8 Jan 2019, 10:57
    0
    • O OPit
      8 Jan 2019, 10:55

      @SGaist said in error LNK2001: unresolved external symbol "public: static struct QMetaObject .. from lib template:

      silly

      Sadly it's not the problem ...

      A Offline
      A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on 8 Jan 2019, 10:57 last edited by
      #14

      @OPit And both have the same architecture, i.e. 32 vs. 64 bit?

      Qt has to stay free or it will die.

      O 1 Reply Last reply 8 Jan 2019, 14:28
      0
      • O OPit
        19 Dec 2018, 07:13

        If I open QtAvWidget1.dll, I found the function :

        ?metaObject@VideoPreviewWidget@QtAV@@UEBAPEBUQMetaObject@@XZ
        

        I can't read .lib file from dependency walker, how can I check these files ?

        K Offline
        K Offline
        kshegunov
        Moderators
        wrote on 8 Jan 2019, 11:13 last edited by kshegunov 1 Aug 2019, 11:15
        #15

        This:

        @OPit said in error LNK2001: unresolved external symbol "public: static struct QMetaObject .. from lib template:

        ?metaObject@VideoPreviewWidget@QtAV@@UEBAPEBUQMetaObject@@XZ
        

        Is very different from this:

        ?staticMetaObject@VideoPreviewWidget@QtAV@@2UQMetaObject@@B
        

        The former is a method, the latter is a (global) variable. Please try again. Could you also provide the content of the moc file in question (the one that fixes the issue if linked with)?

        Read and abide by the Qt Code of Conduct

        1 Reply Last reply
        0
        • A aha_1980
          8 Jan 2019, 10:57

          @OPit And both have the same architecture, i.e. 32 vs. 64 bit?

          O Offline
          O Offline
          OPit
          wrote on 8 Jan 2019, 14:28 last edited by OPit 1 Aug 2019, 14:30
          #16

          @aha_1980 yes, the same architecture

          @kshegunov this is a link to download the file (I can't upload from the forum) :
          https://we.tl/t-bhEPIToZV2

          Thanks.

          K 1 Reply Last reply 9 Jan 2019, 03:03
          0
          • H Offline
            H Offline
            hskoglund
            wrote on 8 Jan 2019, 21:09 last edited by
            #17

            Hi, perhaps it's a namespace problem, you could try changing to a using statement in your InputStreamPreview.h:

            #include <QtAVWidgets/VideoPreviewWidget.h>
            
            using namespace QtAV;
            
            class InputStreamPreview : public VideoPreviewWidget
            {
            Q_OBJECT
            ...
            
            1 Reply Last reply
            1
            • O OPit
              8 Jan 2019, 14:28

              @aha_1980 yes, the same architecture

              @kshegunov this is a link to download the file (I can't upload from the forum) :
              https://we.tl/t-bhEPIToZV2

              Thanks.

              K Offline
              K Offline
              kshegunov
              Moderators
              wrote on 9 Jan 2019, 03:03 last edited by kshegunov 1 Sept 2019, 03:04
              #18

              @OPit said in error LNK2001: unresolved external symbol "public: static struct QMetaObject .. from lib template:

              this is a link to download the file (I can't upload from the forum)

              I'm sorry I wasn't clear. I meant the generated moc_XXX.cpp file. I have no tools to inspect the object file even if I wanted to because I work exclusively on Linux.

              @hskoglund said in error LNK2001: unresolved external symbol "public: static struct QMetaObject .. from lib template:

              Hi, perhaps it's a namespace problem, you could try changing to a using statement in your InputStreamPreview.h

              A decent idea, but I don't think that's it. moc, while not too smart, does recognize namespaces and generates code accordingly. I do use them and everything links fine.

              Read and abide by the Qt Code of Conduct

              1 Reply Last reply
              0
              • O Offline
                O Offline
                OPit
                wrote on 9 Jan 2019, 08:56 last edited by
                #19

                @kshegunov oh sorry, this is the cpp file.

                https://we.tl/t-NXhNCGkSmc

                1 Reply Last reply
                0
                • H Offline
                  H Offline
                  hskoglund
                  wrote on 9 Jan 2019, 12:46 last edited by
                  #20

                  Hi, do you have a moc_VideoPreviewWidget.cpp that's compiled using Qt 5.12? (The one in the link is built with Qt 5.9.1)

                  O 1 Reply Last reply 9 Jan 2019, 16:49
                  0
                  • H hskoglund
                    9 Jan 2019, 12:46

                    Hi, do you have a moc_VideoPreviewWidget.cpp that's compiled using Qt 5.12? (The one in the link is built with Qt 5.9.1)

                    O Offline
                    O Offline
                    OPit
                    wrote on 9 Jan 2019, 16:49 last edited by
                    #21

                    @hskoglund yes of course : https://we.tl/t-Uhhsre7Vzm

                    the problem is the same with version 5.9.1 or 5.12 (and also VS2017 or VS2015)

                    1 Reply Last reply
                    0
                    • H Offline
                      H Offline
                      hskoglund
                      wrote on 9 Jan 2019, 22:15 last edited by
                      #22

                      Hi, if you look in the .pro files above for your application and myStream.lib, both .pro files have a inputstreampreview.cpp and a inputstreampreview.h included. They are not located in the same directory (one pair is in ../../src/ and the other pair is in ../../src/view/) but if they have the same contents then maybe the linker gets confused when you build your app (together with your myStream.lib).

                      If they do not have the same contents (i.e. just a stroke of bad luck with the naming of your files) then rename one of the pairs. Otherwise, you could try building your app again but with only of the pairs, for example commenting out ../../src/view/inputstreampreview.cpp from the SOURCES section in your Application.pro file.

                      O 1 Reply Last reply 11 Jan 2019, 10:33
                      3
                      • H hskoglund
                        9 Jan 2019, 22:15

                        Hi, if you look in the .pro files above for your application and myStream.lib, both .pro files have a inputstreampreview.cpp and a inputstreampreview.h included. They are not located in the same directory (one pair is in ../../src/ and the other pair is in ../../src/view/) but if they have the same contents then maybe the linker gets confused when you build your app (together with your myStream.lib).

                        If they do not have the same contents (i.e. just a stroke of bad luck with the naming of your files) then rename one of the pairs. Otherwise, you could try building your app again but with only of the pairs, for example commenting out ../../src/view/inputstreampreview.cpp from the SOURCES section in your Application.pro file.

                        O Offline
                        O Offline
                        OPit
                        wrote on 11 Jan 2019, 10:33 last edited by
                        #23

                        @hskoglund said in error LNK2001: unresolved external symbol "public: static struct QMetaObject .. from lib template:

                        inputstreampreview.cpp

                        thanks for your answer, but I don't understand well what you want to say.
                        inputstreampreview.cpp/.h are only included in myStream.lib (in src folder).
                        For my main app, I just include the .h with INCLUDEPATH keyword and link myStream lib with LIBS+= -lmyStream
                        I don't know why and where you can see ../../src/view/ path ??

                        K 1 Reply Last reply 12 Jan 2019, 03:33
                        0
                        • H Offline
                          H Offline
                          hskoglund
                          wrote on 11 Jan 2019, 13:59 last edited by
                          #24

                          0_1547215144787_Screenshot from 2019-01-11 14-53-12.png

                          O 1 Reply Last reply 11 Jan 2019, 17:41
                          2
                          • H hskoglund
                            11 Jan 2019, 13:59

                            0_1547215144787_Screenshot from 2019-01-11 14-53-12.png

                            O Offline
                            O Offline
                            OPit
                            wrote on 11 Jan 2019, 17:41 last edited by
                            #25

                            @hskoglund oups it's a mistake, a drag and drop in my exemple app.pro. But even if I remove this entry, I have the same problem.

                            1 Reply Last reply
                            0
                            • H Offline
                              H Offline
                              hskoglund
                              wrote on 12 Jan 2019, 03:31 last edited by hskoglund 1 Dec 2019, 03:33
                              #26

                              Even if you run qmake and rebuild AppTest.exe i.e. Application.pro?

                              1 Reply Last reply
                              0
                              • O OPit
                                11 Jan 2019, 10:33

                                @hskoglund said in error LNK2001: unresolved external symbol "public: static struct QMetaObject .. from lib template:

                                inputstreampreview.cpp

                                thanks for your answer, but I don't understand well what you want to say.
                                inputstreampreview.cpp/.h are only included in myStream.lib (in src folder).
                                For my main app, I just include the .h with INCLUDEPATH keyword and link myStream lib with LIBS+= -lmyStream
                                I don't know why and where you can see ../../src/view/ path ??

                                K Offline
                                K Offline
                                kshegunov
                                Moderators
                                wrote on 12 Jan 2019, 03:33 last edited by kshegunov 1 Dec 2019, 03:36
                                #27

                                I'm pretty sure at this point that for whatever reason your static library didn't include the symbol in question. One way or another you need to find why that happened. It may be a bug with the library, or some misconfiguration.

                                Read and abide by the Qt Code of Conduct

                                1 Reply Last reply
                                0
                                • O Offline
                                  O Offline
                                  OPit
                                  wrote on 16 Jan 2019, 09:34 last edited by
                                  #28

                                  Well, I rebuilt QtAV with a new installation of Qt, and it works ....
                                  So, even if I didn't understand the mistake, thanks a lot for your help !

                                  1 Reply Last reply
                                  0

                                  22/28

                                  9 Jan 2019, 22:15

                                  • Login

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