Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt Visual Studio Tools



  • We have several applications developed using Visual Studios 2017, Qt Visual Studio Tools Vers 2.1.2, VisualGDB 5.5 and Qt Vers 5.12.3. We build on Windows 10 and target Raspberry Pi. Recently due to a computer upgrade I needed to reinstall all of the above tools. I am now getting an undeclared QMetaObject::SuperData. When I look at the generated moc_* file I see that it is using Qt 5.15.2.

    When I reinstalled the Qt Visual Studio Tools, I installed the latest release. I am assuming this is the cause of my compile error. How can I installed an older version of QT Visual Studio Tools?


  • Lifetime Qt Champion

    @sbartolett Please do not double post!
    You already asked same question here: https://forum.qt.io/topic/133342/undeclared-qmetaobject-superdata

    "file I see that it is using Qt 5.15.2" - then make sure you're suing correct Qt version and do a complete rebuild (delete all build artefacts and then build).



  • Sorry for the double post.

    I have tried to clean and doing a complete rebuild. I also have created a new project and I get the same error.

    I'm selecting the Qt version in Visual Studios using Qt VS Tools/Qt Version. That shows that I only have one version of Qt installed - 5.12.3. Is there some other place I should be selecting the Qt version?

    When creating the new project these are the settings I use:
    VisaualGDB/Linux Project Wizard
    Application, Qt, A Qt5-based application (CMake)
    Ninja
    Use the advanced CMake Project Subsystem
    Build the project locally with a cross-compiler
    Cross-toolchain: Raspberry PI in C:\SysGCC\raspberry (GCC 8.30, GDB 8.2.1, Revision 1, Buster



  • We have a little more information regarding our problem.

    When using Visual GDB to create a new QT project for Raspberry PI, if the toolchain folder ‘C:\SysGCC\raspberry\Qt\v5-CMake’ doesn’t exist or is empty, the QT build tools are automatically downloaded and installed. The problem we are seeing is that the build tools end up being a different version (Qt v5.15.2) than what is being used on our target Raspberry Pi platform (Qt v5.12.3). This results in the following error produced by the moc compiler indicating that its attempting to compile using the much newer header libraries.

                LinuxProject1_autogen/EWIEGA46WW/moc_MainWindow.cpp:80:18: error: 'QMetaObject::SuperData' has not been declared
               QMetaObject::SuperData::link<QMainWindow::staticMetaObject>(),
                  ^~~~~~~~~
    

    LinuxProject1_autogen/EWIEGA46WW/moc_MainWindow.cpp:80:65: error: expected primary-expression before ')' token
    QMetaObject::SuperData::linkQMainWindow::staticMetaObject(),

    Is there anything we can set in Visual Studio or elsewhere that will insure the downloaded Qt build tools match the Qt version on the target board?

    This is our development environment

    Windows 10
    Visual Studio 2017
    Qt Visual Studio Tools Version 2.8.1.6
    Visual GDB 5.6R2
    Qt build tools vers 5.12.3

    And we are targetting Raspberry PI OS vresion Raspbian 10.

    We are working around this problem by manually copying the odler set of build tools into ‘C:\SysGCC\raspberry\Qt\v5-CMake’ before making a new project using VisualGDB. We were fortunate that we had an older set of Qt build tools on another development PC to copy these from. This is not a good long term solution for us.