PDA

View Full Version : QTDIR in VS2005?



gfunk
2nd February 2007, 22:22
I build a second configuration of a Qt build (statically linked libraries) in a folder (D:\staticqt\qt-win-commercial-src-4.2.2) and want to link to it. So I add a Qt build to Tools->Options->Qt->Builds at this path. And then I set the "Default Qt Version" to this build.

Now, is the QTDIR environment variable supposed to change to where I point this? Because it doesn't seem to be happening; it still assumes QTDIR is at C:\Qt\4.2.2.
So I have to hardcode the directory into compile paths if I want it to compile and link correctly. Yuck. There must be a better way...

jpn
3rd February 2007, 09:16
There should be something called "Change Qt version" or similar when opening the context menu over the solution in the solution explorer.

WinchellChung
14th June 2007, 17:23
I do not know if this forum frowns upon raising ancient threads from the dead. I apologize in advance.

I'm using a commercial version of Qt for Windows. When it installs, the program start menu has a shortcut called "Visual Studio with Qt 4.2.3". This invokes the qtvars.bat file in my C:\Qt\4.2.3\ folder. That batch file among other things sets QTDIR=C:\Qt\4.2.3

So when I made a statically linked version of Qt (in C:\Qt\4.2.3-static), I made a new qtvars.bat in the static folder's \bin\ directory. It includes set QTDIR=C:\Qt\4.2.3-static and set PATH=C:\Qt\4.2.3-static\bin;%PATH%

I then made a new start menu shortcut by copying the old "Visual Studio with Qt 4.2.3" shortcut, renaming it "Visual Studio with Qt 4.2.3-Static", and editing the Target and Start In fields from "\4.2.3\" to "\4.2.3-static\"

If I want to compile a shared version I invoke "Visual Studio with Qt 4.2.3", otherwise I use "Visual Studio with Qt 4.2.3-Static", to ensure that the QTDIR variable is set properly.

I do not know it this is the preferred solution, but it seems to work.

jpn
14th June 2007, 17:41
I've myself used the same approach too and IMHO it's just fine. :)