QTDIR not found error building project in MSVC

Chris Becke picture Chris Becke · Jan 26, 2010 · Viewed 10.6k times · Source

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.

Answer

Jade picture Jade · Jul 9, 2012

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.