⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

VS2013 + QT Addin: No way to generate moc files

  • Hi,
    after 4 hours of trying to solve this issue I am at the moment in at a point where I want to throw my laptop out of the window so hopefully someone has an idea.

    I have Visual Studio 2013, QT Library 5.4 and the QT5 Visual Studio Add-in 1.2.4.
    I have one moc file in my Project it is the moc file from the MainWindow which I think was automatically created during project creation.

    This moc.file works pretty well everything works fine and I can create fully functional signal slot connections.
    I can also create new slots and signals and connect them.

    The problem is if i create a new header file (listmodel for my listview) and try to build slots the project doesn't compile because (I think) of the missing moc file.

    This is my test header file:
    @#include "qobject.h"

    class Foo : public QObject{


    public slots:
    void test();


    I read a couple of blog entries about that topic and all the advises I could find.
    I tried to delete, save and enter the Q_OBJECT macro again.
    I tried to delete the debug folder, the generated files folder.
    I tried to clean and rebuild the solution also with qmake and nothing worked.

    The reinstallation of QT Library and Plugin were also unsuccessfull.

    If you have an idea or a way to make it work please let me know.
    I found one blog post about manually create the moc files with build scripts and cmd line but it didn't work but I am still a rookie in C++ maybe I did something wrong I never used build scripts before and the guide was not very rookie friendly.


  • @Fenrix I have a similar problem.
    I moved from VS2008 + Qt4.8.0 to VS2013 + Qt5.5.0
    The most of it worked fine with VS Add-In 1.2.4.

    But There is a problem, that new files and also existing files with custom build steps (moc, uic, qrc, ...) are not automatically called before compiler.

    Hope someone has a solution for this, because now I have manually compile the headers (with Q_OBJECT) or the ui files to get moc and ui_xyz.h files generated.

Log in to reply