VS Addin: moc not run for all files, even with clean rebuild
-
The VS Addin (in my VS 2010) often does not recognize it needs to moc files. Most notably, this happens if the Q_OBJECT macro was added outside VS.
The real problem is that the add-in does not seem to re-evaluate which files to moc, even if I clean-rebuild.
Is there a way to tell the Addin that it should check all files? Is there a way to manually run moc for a single file (other than remove+add in project, or doing a pseudo-code change)?
-
You have to import the pro-file again or run qmake again, after you changed something concerning MOC, UIC, etc.
-
Importing the pro file takes about 15 minutes for large projects, plus another 20 minutes manual work to get all the project settings right.
Compared to this, removing and adding the files to the project is the easier way.
But thanks for the suggestion.
-
Well, because of this unnerving situation for big projects, I also stopped using the pro-import of the VS Add-In and instead start the following script in a WINDOWS command line in the project's root directory:
@%QTDIR%\bin\qmake -spec %QMAKESPEC% -tp vc -recursive@
and reload the solution file.
-
Interesting. What exactly does it do?
Currently, we manually update both projects and solutions when changes are made. We can live with it, but it's always extra work.
-
This call makes qmake create a Visual Studio solution file (if there is only one .pro-file in the directory).
QMAKESPEC is something like: C:\Qt\5.3.1\mkspecs\win32-msvc2013
So I usually unload the solution, run the script and reload the solution again. (But I edit the .pro and .pri-files manually.) -
Good to know. Thanks!