每次运行qmake时,Visual Studio都会重新编译“moc”文件

时间:2013-09-27 18:31:50

标签: c++ visual-studio qt visual-studio-2012 qtcore

我有一个非常大的项目,用Qt开发了C / CPP。每次我更改.pri或.pro文件中的设置时,我都必须使用qmake转换项目。

我这样做:

qmake -spec win32-msvc2012 -tp vc $projectName.pro

之后我在Visual Studio(2012)中重新加载项目。

每当我重新生成所有“moc”文件并且整个项目完全编译/重建时,我构建项目。有没有一种方法可以重新编译已更改/新包含的文件?

1 个答案:

答案 0 :(得分:2)

您应该使用Visual Studio Add-In for Qt 5。还有一个用于Qt 4,虽然旧版本(1.1.11)不支持VS 2012.你可以在这里找到关于此的最新博客文章:

http://blog.qt.digia.com/blog/2013/04/11/visual-studio-add-in-1-2-1-for-qt-5-released/

除此之外,您将获得更多功能,而不仅仅是您在这里写的内容。请参阅此更改日志以获取最新版本:

Qt Visual Studio加载项1.2.1版包含多个错误修正和 改进。

Changes
-------
- Qt 5.0.1 help documents included
- Qmake wrapper COM component removed and replaced with command line tool
  qmakefilereader to avoid need to load Qt5 library binaries to Visual Studio
  process. And to get installation of add-in easier, specially with VS2008.
- Qt4 add-in is not allowed to run same time, if found it will be closed.
  Also if Qt4 add-in is present in system, default editor values for .ts, .ui
  and .qrc file types are not permanently overwritten by Qt5 add-in. Values are
  written when Qt5 add-in loads and Qt4 values are set when Qt5 add-in unloads.
  This should make it possible to install and use both Qt4 and Qt5 versions of
  add-in. Not to use same time but in turns. Though user must be careful what he
  does.
- Recognizing Qt5 CE build. (QTVSADDINBUG-153)
- Incorrect additional directories paths set when Qt modules added/removed from
  Qt Project Settings page. (QTVSADDINBUG-151)
- Include directories search path for some Qt modules fixed (QTVSADDINBUG-150)
- Invalid Qt module names fixed (QTVSADDINBUG-142)
- Crash when importing .pri file fixed (QTVSADDINBUG-139)
- Qt default settings saving problem fixed (QTVSADDINBUG-137)
- Naming of precompiled header fixed (QTVSADDINBUG-132)
- Support for debugger visualizers in VS2012 (QTVSADDINBUG-129)
- Setting Qt libraries path for debugging session fixed (QTVSADDINBUG-125)