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: Unresolved
    • P2: Important
    • None
    • 3.1.0 (rev.02)
    • Build-time integration
    • None
    • Windows 10
    • Windows

    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. build_and_log.zip
          569 kB
        2. QML.zip
          175 kB
        3. QML2.zip
          11.33 MB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

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

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes