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. How to compile source code of QtPropertyBrowser by VS2019 correctly?

How to compile source code of QtPropertyBrowser by VS2019 correctly?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 4 Posters 1.1k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Thanks for your time.
    I created a QT widget application by VS wizard (sln managed), then i copied source code from "Qt\5.15.0\Src\qttools\src\shared\qtpropertybrowser" to my project.
    When i compiled it, errors happeded, like below:

    1>E:\QtPropertyBrowserDemo\QtPropertyBrowserDemo\x64\Debug\moc\moc_qtbuttonpropertybrowser.cpp(94,29): error C2027: use of undefined type 'QtButtonPropertyBrowserPrivate'
    1>E:\QtPropertyBrowserDemo\QtPropertyBrowserDemo\qtpropertybrowser\qtbuttonpropertybrowser.h(47): message : see declaration of 'QtButtonPropertyBrowserPrivate'
    1>E:\QtPropertyBrowserDemo\QtPropertyBrowserDemo\x64\Debug\moc\moc_qtbuttonpropertybrowser.cpp(95,29): error C2027: use of undefined type 'QtButtonPropertyBrowserPrivate'
    1>E:\QtPropertyBrowserDemo\QtPropertyBrowserDemo\qtpropertybrowser\qtbuttonpropertybrowser.h(47): message : see declaration of 'QtButtonPropertyBrowserPrivate'
    1>E:\QtPropertyBrowserDemo\QtPropertyBrowserDemo\x64\Debug\moc\moc_qtbuttonpropertybrowser.cpp(96,29): error C2027: use of undefined type 'QtButtonPropertyBrowserPrivate'
    1>E:\QtPropertyBrowserDemo\QtPropertyBrowserDemo\qtpropertybrowser\qtbuttonpropertybrowser.h(47): message : see declaration of 'QtButtonPropertyBrowserPrivate'
    1>E:\QtPropertyBrowserDemo\QtPropertyBrowserDemo\x64\Debug\moc\moc_qtpropertybrowser.cpp(377,29): error C2027: use of undefined type 'QtAbstractPropertyBrowserPrivate'
    

    its a long error list, so i just paste some here.

    I tried ervery way i can think of, like use precompiled headers, compare my project with qttools/designer, but i still cannot find the
    problem.

    So anyone can help me out? I commited my project on GitHub, you can pull it if you wish.

    Address is here: https://github.com/LiangZuoting/QtPropertyBrowserDemo

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by Chris Kawa
      #2

      Hi, welcome to the forum.

      The problem is your project is set up to compile the generated moc_XXX.cpp files for the qtpropertybrowser headers .
      In this case they are included at the end of qtXXX.cpp files and are not meant to be compiled separately, as they make use of the private implementation in the ccp.

      To fix this, in VS, select all the qtXXX.h files from qtpropertybrowser (except for the qtXXX_p.h). Right click and select Properties.
      In the property page go to Configuration Properties -> Qt Meta-Object-Compiler -> moc and set Dynamic C++ Source to Disable. This will exclude generated moc_ files from direct compilation. They will be compiled as an include in the cpp files from qtpropertybrowser, the way they were meant to be.

      ? H Q 3 Replies Last reply
      4
      • Chris KawaC Chris Kawa

        Hi, welcome to the forum.

        The problem is your project is set up to compile the generated moc_XXX.cpp files for the qtpropertybrowser headers .
        In this case they are included at the end of qtXXX.cpp files and are not meant to be compiled separately, as they make use of the private implementation in the ccp.

        To fix this, in VS, select all the qtXXX.h files from qtpropertybrowser (except for the qtXXX_p.h). Right click and select Properties.
        In the property page go to Configuration Properties -> Qt Meta-Object-Compiler -> moc and set Dynamic C++ Source to Disable. This will exclude generated moc_ files from direct compilation. They will be compiled as an include in the cpp files from qtpropertybrowser, the way they were meant to be.

        ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        @Chris-Kawa cooooool, you saved me! thanks a lot.

        1 Reply Last reply
        0
        • Chris KawaC Chris Kawa

          Hi, welcome to the forum.

          The problem is your project is set up to compile the generated moc_XXX.cpp files for the qtpropertybrowser headers .
          In this case they are included at the end of qtXXX.cpp files and are not meant to be compiled separately, as they make use of the private implementation in the ccp.

          To fix this, in VS, select all the qtXXX.h files from qtpropertybrowser (except for the qtXXX_p.h). Right click and select Properties.
          In the property page go to Configuration Properties -> Qt Meta-Object-Compiler -> moc and set Dynamic C++ Source to Disable. This will exclude generated moc_ files from direct compilation. They will be compiled as an include in the cpp files from qtpropertybrowser, the way they were meant to be.

          H Offline
          H Offline
          Hamilton_Wang
          wrote on last edited by Hamilton_Wang
          #4

          @Chris-Kawa , Could you help me to solve the same issue on Qt platform(QtCreator4.9.1 Based on Qt 5.12.3 (MSVC 2017, 32 bit)). How to exclude generated moc_files from direct compilation?

          1 Reply Last reply
          0
          • Chris KawaC Chris Kawa

            Hi, welcome to the forum.

            The problem is your project is set up to compile the generated moc_XXX.cpp files for the qtpropertybrowser headers .
            In this case they are included at the end of qtXXX.cpp files and are not meant to be compiled separately, as they make use of the private implementation in the ccp.

            To fix this, in VS, select all the qtXXX.h files from qtpropertybrowser (except for the qtXXX_p.h). Right click and select Properties.
            In the property page go to Configuration Properties -> Qt Meta-Object-Compiler -> moc and set Dynamic C++ Source to Disable. This will exclude generated moc_ files from direct compilation. They will be compiled as an include in the cpp files from qtpropertybrowser, the way they were meant to be.

            Q Offline
            Q Offline
            quanshui
            wrote on last edited by
            #5

            @Chris-Kawa Thank you!

            1 Reply Last reply
            0

            • Login

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