Uploaded image for project: 'Qt Visual Studio Tools'
  1. Qt Visual Studio Tools
  2. QTVSADDINBUG-1173

QML plugin with static build

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 3.3.0
    • 3.1.0 (rev.02)
    • None
    • Windows 10
    • Windows
    • f3b0145ec (dev), eba0f6484 (dev), bfac24d89 (dev), dc6093b2b (dev)

    Description

      I have Qt compiled static, when I try to compile my application I get link errors about the particles plugin.

      I'm compiling using Visual Studio 2022 and Qt 6.6.0.

      Follow a reproducible example:

      #include <QtWidgets>
      #include <QQuickWidget> 
      #include <QGridLayout>   
      
      int main(int argc, char *argv[]) {     
      
        QApplication a(argc, argv);  
           
        QWidget w;     
        QGridLayout* gridLayout = new QGridLayout(&w);   
          
        QQuickWidget* view = new QQuickWidget(&w); 
        view->setSource(QUrl("qrc:/particles.qml")); 
        view->setResizeMode(QQuickWidget::SizeRootObjectToView); 
        
        gridLayout->addWidget(view, 0, 0);         
        
        w.resize(620, 300);     
        w.show(); 
          
        return a.exec(); 
      }

      particles.qml

      import QtQuick 2.5
      import QtQuick.Particles 2.0
      
      Rectangle {
          id   : root
          color: 'black' 
          ParticleSystem { 
              id: system
          }    
          ImageParticle {
              system           : system
              source           : 'qrc:/snow.png'
              color            : 'red'
          }    
          Emitter {
              anchors.fill     : root
              system           : system
              size             : 32
          }
      } 

       

      1>Build FAILED.
      1>
      1>particlesplugin.lib(particlesplugin_QtQuick2ParticlesPlugin.cpp.obj) : error LNK2019: unresolved external symbol "void __cdecl qml_register_types_QtQuick_Particles(void)" (?qml_register_types_QtQuick_Particles@@YAXXZ) referenced in function "public: static __cdecl `public: static void (__cdecl*__cdecl QtPrivate::QMetaTypeForType<class QtQuick2ParticlesPlugin>::getDefaultCtr(void))(class QtPrivate::QMetaTypeInterface const *,void *)'::`5'::<lambda_1>::<lambda_invoker_cdecl>(class QtPrivate::QMetaTypeInterface const *,void *)" (?<lambda_invoker_cdecl>@<lambda_1>@?4??getDefaultCtr@?$QMetaTypeForType@VQtQuick2ParticlesPlugin@@@QtPrivate@@SAP6AXPEBVQMetaTypeInterface@4@PEAX@ZXZ@SA@01@Z)
      1>C:\Users\QML\x64\Release\QML.exe : fatal error LNK1120: 1 unresolved externals
      1>    0 Warning(s)
      1>    2 Error(s)

      Follow a Visual Studio sample project QML.zip

      Attachments

        1. QML.zip
          175 kB
        2. QML2.zip
          11.33 MB
        3. build_and_log.zip
          569 kB
        4. Qml10-17.zip
          20.33 MB
        5. image-2024-11-13-18-50-41-774.png
          image-2024-11-13-18-50-41-774.png
          213 kB
        6. QtMSBuild_3.3.0.39.zip
          149 kB
        7. msbuild.binlog
          396 kB
        8. clean_log_msbuild.binlog
          395 kB
        9. image-2024-11-18-17-55-20-497.png
          image-2024-11-18-17-55-20-497.png
          33 kB
        10. clean_log_2_msbuild.binlog
          415 kB
        11. Qml10-17.mp4
          5.05 MB
        12. 2024-11-19 19-21-26.mp4
          14.25 MB
        For Gerrit Dashboard: QTVSADDINBUG-1173
        # Subject Branch Project Status CR V

        Activity

          People

            mecfc Miguel Costa
            ruann Caio Alves
            Votes:
            0 Vote for this issue
            Watchers:
            13 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes