QTDIR not found error building project in MSVC

旧时模样 提交于 2019-12-07 02:10:21

问题


Using MSVC 2008 SP1, and qt-vs-addin-1.1.2

I have a pre-existing project in MSVC that I have QT'ified: In main I added a QApplciation, and my windows are now all QWidgets. I added custom build steps for my .qrc and .ui files and "moc" as a custom build step on any Q_OBJECT header files.

This all functions - the project builds and runs, and the variant on XCode works too.

However my project still behaves differently to a project created using the Qt wizard :- Namely the Qt addin does NOT set the QTDIR build variable. Nor does it offer any of the Qt configuration options on the project context menu - they're all greyed out.

I can work around the QTDIR issue by setting the default QTDIR in my environment. But I would like to resolve what the Qt addin has done to the project - eyeballing the (xml) vcproj file of a Qt generated project vs a Visual Studio project does not reveal any obvious signs of what the Qt-addin is looking for to treat the project properly.


回答1:


QTDIR is added as a Property in the Visual Studio Project User Option file for your project. The file has the extension .vcxproj.user, and is in the same directory and has the same base name as your project file. As far as I can tell there is no way to modify, add or delete the QTDIR property besides directly editing the file.

Note, this property can be put in other files besides the User Option file. I placed it in a property sheet, so all I have to do to setup a Qt project is to add a property sheet.



来源:https://stackoverflow.com/questions/2139495/qtdir-not-found-error-building-project-in-msvc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!