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

Add new item with VS does not generate the moc

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 1.2.4
    • Fix Version/s: 2.1.2
    • Component/s: General
    • Environment:
      Windows 7
      Visual Studio 2013
      Qt5.3.2
      Qt5Addin 1.2.4
    • Commits:
      af5dcc0ac037b902c6ce87fca7f71bdaeab96e41

      Description

      The custom build to generate the moc for the header is not set when the header is added with Visual Studio wizard ( "Add -> New Item..." )

      To repodruce:

      • Create a Qt project with Visual Studio 2013
      • Add -> New Item...
      • Choose Header file (.h)
      • MyFile.h
        #ifndef MYFILE_H
        #define MYFILE_H
        
        #include <QObject>
        
        class MyFile : public QObject
        {
        	Q_OBJECT
        
        public:
        	MyFile(QObject *parent);
        	~MyFile();
        
        private:
        };
        
        #endif // MYFILE_H
        
      • Build solution

      Result:
      1>------ Build started: Project: Test, Configuration: Release x64 ------
      1> moc_MyFile.cpp
      1>c1xx : fatal error C1083: Cannot open source file: 'Moc\moc_MyFile.cpp': No such file or directory

      Extra information:
      Removing and then adding the Q_OBJECT does not generate the moc but it is working fine if I add the file with "Add -> Existing item..." So as long as a file is added with "Add -> New item..." there is no way to have the moc file

        Attachments

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              • Assignee:
                mecfc Miguel Costa
                Reporter:
                r1z1 Erwan
              • Votes:
                2 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes