Configuring QT Creator environment
Hi all,
How do you configure QT Creator's environment (e.g. the environment variables used) in a similar way qtenv.bat does this for the QT command line?
Do you know any articles on how to configure your system (environment variables and such) to run Creator, especially when you have other IDEs installed as well (Visual Studio 6 in my case)?
The question is related to this thread, which describes my difficulties building a sample (starting on the command line, but later spilling over to Creator)
Re: Configuring QT Creator environment
You don't need to configure Creator through environment variables but if you want to, you can change the default version of Qt used by Creator by setting the path to qmake in PATH env variable.
Re: Configuring QT Creator environment
On Windows you change environment variables by right clicking My Computer -> Properties -> Advanced -> Environment variables. You then need to restart any applications that you want note the change (assuming you start the app from the desktop). The most useful variable for when you don't use QtCreator is QTDIR in the user section. For Visual Studio use, it should be set before you launch the IDE.
Re: Configuring QT Creator environment
I was not talking about how to set the environment variables in Windows, rather how I set them in Creator.
Having multiple IDEs on the same system causes multiple conflicts, where executables of the same name but in different versions exist. I need to tell Creator, not my system, where to access the correct applications.
For the QT command line, I do that using qtvars.bat. How do I do it for Creator?
I know I can change the path in the project settings, but what I need are global settings.
A second issue I discovered yesterday is that qmake crashes when started from Creator. When I try to emulate the same behaviour using QT command line (exact same call with same parameters), it either works (if I am in the folder where the .pro file is) or at worst tells me it can't find rcc.exe (when I am in the QT base folder).
My current best guess is that Creator uses different paths, and therefore qmake uses different DLLs or EXEs, and crashes. To the best of my knowledge, I entered exactly the same path and other environment variables in "Build Environment" that I use in the QT command line, where qmake works just fine.
Re: Configuring QT Creator environment
Quote:
Originally Posted by
fatjuicymole
On Windows you change environment variables by right clicking My Computer -> Properties -> Advanced -> Environment variables.
This isn't entirely true you know... You can change environment variables from the command line and I think that's what the question was about.
Re: Configuring QT Creator environment
Quote:
Originally Posted by
wysota
This isn't entirely true you know... You can change environment variables from the command line and I think that's what the question was about.
How do I get a command line in Creator (so I can configure the Creator environment)?
Re: Configuring QT Creator environment
You have to setup environment variables BEFORE you run Creator. Otherwise Creator won't pick them up - that's how environment variables work. So open the command prompt, set your vars and then call Creator from the same command line. You can make a copy of qtenv.bat and modify the contents (remember to call Creator at the end).
Re: Configuring QT Creator environment
Quote:
Originally Posted by
wysota
You have to setup environment variables BEFORE you run Creator. Otherwise Creator won't pick them up - that's how environment variables work. So open the command prompt, set your vars and then call Creator from the same command line. You can make a copy of qtenv.bat and modify the contents (remember to call Creator at the end).
I have tried starting Creator from the QT command line before. I must have done something wrong then, because now it works!
qmake still crashes when I use the "Clean Environment", but works just fine with the regular environment (I have removed the Include references to Visual Studio 6 paths, and that seems to do wonders).
I'll now create my own bat file for starting Creator, as you suggested. THANKS!
Re: Configuring QT Creator environment
Quote:
Originally Posted by
wysota
This isn't entirely true you know... You can change environment variables from the command line and I think that's what the question was about.
It seemed a little daft to ask how to set environment variables from the command line when you already know how to set them from the command line by using qtenv.bat, hence my suggestion.
Also, as you probably know, environment variables set from the command line are lost when the command line is closed. Environment variables set from the GUI are kept across system reboots.
Quote:
Originally Posted by
Asperamanca
I'll now create my own bat file for starting Creator, as you suggested. THANKS!
If you set the variables in the GUI, there's no need for a bat file, and you can start Creator from the desktop rather than from the command prompt.
I use Visual Studio 2008 with this configuration and I have no problems whatsoever - I just set QTDIR in the GUI environment variables page and everything works as it should.
Re: Configuring QT Creator environment
Quote:
Originally Posted by
Steven
If you set the variables in the GUI, there's no need for a bat file, and you can start Creator from the desktop rather than from the command prompt.
I can't, because the global environment variables contain INCLUDEs that break QT. But I can just as well create a desktop link to my bat file - once I have that, there's really no difference to a "normal" link (except I have a command prompt open while running Creator - but I get that in 1.3.0 beta, anyway)
Quote:
Originally Posted by
Steven
I use Visual Studio 2008 with this configuration and I have no problems whatsoever - I just set QTDIR in the GUI environment variables page and everything works as it should.
Visual Studio 6 is a different thing. I can't even blame it for having outdated header files.