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

Qt Visual Studio Tools 2.6.0: moc doesn't respect defines from .qmake.conf

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 2.6.0 (rev.07)
    • 2.6.0
    • Build-time integration
    • None
    • Visual Studio 2019 with Qt Visual Studio Tools 2.6.0, Qt 5.12.9 LTS
    • Windows
    • b8144fdf6bb032a67929f1caf4038373b1fdbf1c

    Description

      This is for QTVS 2.6.0, but this bug reporter doesn't let me select this version yet.

      With Qt Visual Studio Tools 2.6.0, the moc compiler doesn't see defines from the .qmake.conf file. To reproduce this, I have attached a small sample project. I have imported this into VS 2019 via Extensions / Qt VS Tools / Open Qt Project File (.pro).

      When opened with Visual Studio 2019 + Qt 5.12.9 + Qt VS Tools 2.5.2, the compiler outputs this:

       

      1>------ Build started: Project: VsToolsTest, Configuration: Debug x64 ------
      1>Uic'ing mainwindow.ui...
      1>Moc'ing mainwindow.h...
      1>main.cpp
      1>mainwindow.cpp
      1>moc_mainwindow.cpp
      1>VsToolsTest.vcxproj -> C:\Users\me\Documents\Code\VsToolsTest\debug\VsToolsTest.exe
      ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

       

       

       

      When opening a clean copy of this project in Qt VS Tools 2.6.0, compilation fails:

      1>------ Build started: Project: VsToolsTest, Configuration: Debug x64 ------
      1>Generate moc_predefs.h
      1>Uic'ing mainwindow.ui...
      1>Moc'ing mainwindow.h...
      1> C:\Users\me\Documents\Code\VsToolsTest\mainwindow.h(0): Note: No relevant classes found. No output generated.
      1>main.cpp
      1>mainwindow.cpp
      1>moc_mainwindow.cpp
      1>mainwindow.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __cdecl MainWindow::metaObject(void)const " (?metaObject@MainWindow@@UEBAPEBUQMetaObject@@XZ)
      1>mainwindow.obj : error LNK2001: unresolved external symbol "public: virtual void * __cdecl MainWindow::qt_metacast(char const *)" (?qt_metacast@MainWindow@@UEAAPEAXPEBD@Z)
      1>mainwindow.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl MainWindow::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@MainWindow@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z)
      1>debug
      VsToolsTest.exe : fatal error LNK1120: 3 unresolved externals
      1>Done building project "VsToolsTest.vcxproj" – FAILED.
      ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

       

       

       

      Attachments

        Issue Links

          For Gerrit Dashboard: QTVSADDINBUG-822
          # Subject Branch Project Status CR V

          Activity

            People

              mecfc Miguel Costa
              karlwolfram Karl Wolfram
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes