Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. When building QGIS source code with QT Creator in windows 10, there are some error LNK2001.
Forum Updated to NodeBB v4.3 + New Features

When building QGIS source code with QT Creator in windows 10, there are some error LNK2001.

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 395 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    haowong
    wrote on last edited by haowong
    #1

    What is the bug or the crash?

    [2961/5289 3.3/sec] Automatic MOC for target test_core_layoutitem
    [2962/5289 3.3/sec] Automatic MOC for target test_core_layoutitemgroup
    [2963/5289 3.3/sec] Linking CXX shared library output\bin\qgis_gui.dll
    FAILED: output/bin/qgis_gui.dll src/gui/qgis_gui.lib 
    C:\Windows\system32\cmd.exe /C "cd . && E:\CMake\bin\cmake.exe -E vs_link_dll --intdir=src\gui\CMakeFiles\qgis_gui.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- E:\MICROS~1\MICROS~2\VC\Tools\MSVC\1442~1.344\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\qgis_gui.rsp  /out:output\bin\qgis_gui.dll /implib:src\gui\qgis_gui.lib /pdb:output\bin\qgis_gui.pdb /dll /version:3.39 /machine:x64 /debug /INCREMENTAL && cd ."
    LINK Pass 1: command "E:\MICROS~1\MICROS~2\VC\Tools\MSVC\1442~1.344\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\qgis_gui.rsp /out:output\bin\qgis_gui.dll /implib:src\gui\qgis_gui.lib /pdb:output\bin\qgis_gui.pdb /dll /version:3.39 /machine:x64 /debug /INCREMENTAL /MANIFEST /MANIFESTFILE:src\gui\CMakeFiles\qgis_gui.dir/intermediate.manifest src\gui\CMakeFiles\qgis_gui.dir/manifest.res" failed (exit code 1120) with the following output:
      正在创建库 src\gui\qgis_gui.lib 和对象 src\gui\qgis_gui.exp
    qgstemporalcontrollerwidget.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgstextformatwidget.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgsunitselectionwidget.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgsqueryresultwidget.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgsstyleitemslistwidget.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgssubstitutionlistwidget.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgstablewidgetbase.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgsorderbydialog.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgspanelwidgetstack.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgspresetcolorrampdialog.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgsproviderguiregistry.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgsnewhttpconnection.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgsnewmemorylayerdialog.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgsnewvectorlayerdialog.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgsnewgeopackagelayerdialog.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgsfeatureselectiondlg.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgsfielddomainwidget.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgsformlabelformatwidget.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgshttpheaderwidget.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgsexpressionbuilderwidget.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgsexpressionlineedit.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgsexpressionpreviewwidget.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgsexpressionselectiondialog.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgscompoundcolorwidget.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgscredentialdialog.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgsdatasourceselectdialog.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgsexpressionbuilderdialog.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    qgsvectortilesourceselect.cpp.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QToolButton::checkStateSet(void)" (?checkStateSet@QToolButton@@MEAAXXZ)
    

    Steps to reproduce the issue

    1. Open source code file cmake file.
    2. Build all projects under 'Release with Debug Information' mode.

    Versions

    3.39

    Supported QGIS version

    • I'm running a supported QGIS version according to
      the roadmap.

    New profile

    • I tried with a new
      QGIS profile

    Additional context

    As for the build kit for QT creator:

    • Compiler: Visual Studio Enterprise 2022 17.12.35527.113 (amd64)
    • Debugger: Auto-detected CDB at C:Program Files (x86)\Windows Kits\10\Debuggers\x86\cdb.exe
    • QT version: Qt 5.15.2 MSVC2019 64bit
    1 Reply Last reply
    0
    • H haowong

      @ChrisW67
      Hi sorry for the late reply.
      I don't quite understand what you mean, but I feel the simplest solution of your answer is to use QT6 version for building?
      And Is there a reasonable solution if QT5 is consistently used?

      JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by
      #4

      @haowong What @ChrisW67 pointed out is you are using Qt5 and Qt6 at the same time. Simply use Qt5 or Qt6, but not both.

      H 1 Reply Last reply
      0
      • C Offline
        C Offline
        ChrisW67
        wrote on last edited by
        #2

        @haowong said in When building QGIS source code with QT Creator in windows 10, there are some error LNK2001.:

        protected: virtual void __cdecl QToolButton::checkStateSet(void)

        It looks like you have a mixture of source code built against Qt 6 but trying to link against Qt 5 libraries.

        In Qt 5.15 the protected QToolButton::checkStateSet() is inherited from QAbstractButton and there is no override in QToolButton. In Qt 6.x there is a QToolButton::checkStateSet() override in QToolButton.

        H 1 Reply Last reply
        0
        • C ChrisW67

          @haowong said in When building QGIS source code with QT Creator in windows 10, there are some error LNK2001.:

          protected: virtual void __cdecl QToolButton::checkStateSet(void)

          It looks like you have a mixture of source code built against Qt 6 but trying to link against Qt 5 libraries.

          In Qt 5.15 the protected QToolButton::checkStateSet() is inherited from QAbstractButton and there is no override in QToolButton. In Qt 6.x there is a QToolButton::checkStateSet() override in QToolButton.

          H Offline
          H Offline
          haowong
          wrote on last edited by
          #3

          @ChrisW67
          Hi sorry for the late reply.
          I don't quite understand what you mean, but I feel the simplest solution of your answer is to use QT6 version for building?
          And Is there a reasonable solution if QT5 is consistently used?

          JoeCFDJ 1 Reply Last reply
          0
          • H haowong

            @ChrisW67
            Hi sorry for the late reply.
            I don't quite understand what you mean, but I feel the simplest solution of your answer is to use QT6 version for building?
            And Is there a reasonable solution if QT5 is consistently used?

            JoeCFDJ Offline
            JoeCFDJ Offline
            JoeCFD
            wrote on last edited by
            #4

            @haowong What @ChrisW67 pointed out is you are using Qt5 and Qt6 at the same time. Simply use Qt5 or Qt6, but not both.

            H 1 Reply Last reply
            0
            • JoeCFDJ JoeCFD

              @haowong What @ChrisW67 pointed out is you are using Qt5 and Qt6 at the same time. Simply use Qt5 or Qt6, but not both.

              H Offline
              H Offline
              haowong
              wrote on last edited by haowong
              #5
              This post is deleted!
              1 Reply Last reply
              0
              • H haowong has marked this topic as solved on

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved