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

LNK2019 for Qt Quick application with static Qt builds

    XMLWordPrintable

Details

    • 8c816ca7cb (qt-labs/vstools/dev)

    Description

      Steps to reproduce

      1. Build a static version of Qt 6.2.4 (configure.bat -platform win32-msvc -release -nomake examples -nomake tests -opengl desktop -static -static-runtime)
      2. In Visual Studio, create a new Hello World project: "File" > "New" > "Project..." (Ctrl + Shift + N) > "Qt Quick Application"
      3. Right-click the application in the Solution Explorer and select "Properties" (Alt + Enter)
      4. Go to "Configuration Properties" > "C/C++" > "Code Generation" and set "Runtime Library"="Multi-threaded (/MT)"
      5. Build the project

       

      The project build will fail:

      1>   Creating library D:\Projects\QtQuickApplication1\x64\Release\QtQuickApplication1.lib and object D:\Projects\QtQuickApplication1\x64\Release\QtQuickApplication1.exp
      1>workerscriptplugin.lib(workerscriptplugin_QtQmlWorkerScriptPlugin.cpp.obj) : error LNK2019: unresolved external symbol "void __cdecl qml_register_types_QtQml_WorkerScript(void)" (?qml_register_types_QtQml_WorkerScript@@YAXXZ) referenced in function "private: static __cdecl <lambda_9ebd89eb0fe6b652d7b760a364b8cb4e>::<lambda_invoker_cdecl>(class QtPrivate::QMetaTypeInterface const *,void *)" (?<lambda_invoker_cdecl>@<lambda_9ebd89eb0fe6b652d7b760a364b8cb4e>@@CA@PEBVQMetaTypeInterface@QtPrivate@@PEAX@Z)
      1>D:\Projects\QtQuickApplication1\x64\Release\QtQuickApplication1.exe : fatal error LNK1120: 1 unresolved externals
      

       

      Notes

      • The build will succeed if the same static Qt libraries are used to build the same code in Qt Creator
      • The build will succeed if dynamic Qt libraries are used to build the same code in Visual Studio

      Attachments

        Issue Links

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

          Activity

            People

              mecfc Miguel Costa
              skoh-qt Sze Howe Koh
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes