Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-114369

Moc Do not export(import) symbols for windows shared library

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Not Evaluated
    • None
    • 6.5.0
    • Build tools: moc
    • None
    • I have tested on windows, linux, and macos github action runers.
      You can see simple reproducible enviroment on https://github.com/EddyTheCo/Bugreport
    • Windows

    Description

      Shared libraries that use signal and slots fail to link on windows.
      You can see simple reproducible example of the issue here, and just do

      qt-cmake -G Ninja -DCMAKE_BUILD_TYPE="release"  -DCMAKE_INSTALL_PREFIX="../install" -DBUILD_SHARED_LIBS=ON ../SourceCode

      When linking 2 libraries that use signal and slots and specifically  expand the

      Q_OBJECT macro with the declaration of 

      public: static struct QMetaObject const Xclass::staticMetaObject 

      The linker return

      error LNK2019: unresolved external symbol "public: static struct QMetaObject const Xclass::staticMetaObject"

      This only happen on windows, I have compiled without problems the same library for macos and linux.

      I am wondering if the problem is that moc(or the Q_OBJECT macro) do not export(import) correctly the missing symbol like

      Q_DECL_EXPORT(Q_DECL_IMPORT) static struct QMetaObject const Xclass::staticMetaObject 
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            fabiankosmale Fabian Kosmale
            mesrine Eduardo Gonzalez
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes