Handling multiple toolchains
-
It appears that the toolchain setting is not remembered on a project basis.
I have one project that needs MinGW and another that needs MSVC. I cannot seem to get the setting in Qt Creator Tools:Options:Build&Run:ToolChains to remember (or even use) the tool chain that I specify. Both MSVC and MinGW selections appear. I need to switch back and forth reguarly and have trouble getting it to switch.
Can anyone please help?
-
welcome to devNet,
you won't have need to change tool chains for every project. just define them all once and select the one's required when configuring your project (creating a new project) -
if you've already created your project, just select to open edit window from the left panel, "Projects"
-
You are obviously using Qt Creator on windows... but which version? Which kind of project are you building (is it based on qmake, cmake, autotools, a generic project)?
What exactly is your problem? Tools->Options->Build & Run->Tool Chains should list all tool chains creator knows about. You should not need to do anything there but to add any tool chains creator might have missed.
In Projects mode (those icons going down the left side of the screen) you pick which of the tool chains is used in your project. Creator uses the tool chain to parse the output of the compiler. When using qmake-based project (those with a .pro-file) the tool chain will also suggest mkspec files. In any case: Creater does remember which tool chain you selected in Projects mode.
-
QtCreator 2.4.1 Both projects have .pro files (qmake based).
I can see MinGW selections in Tools->Options->Build & Run->Tool Chains but not in the project mode->Build Settings. There I see four MSVC selections for Qt 4.7.4 Debug and Release and Qt 4.8.1 Debug and Release.
Is the selected toolchain in the .pro or elsewhere saved?
Must QtCreator have been built by the desired tool chain?
-
Creator only offers compilers that have a chance to produce working code in Projects mode.
So you are most likely having a project using a Qt version built with a MSVC compiler. MSVC libraries can not get mixed with mingw binaries, so Creator does not offer the compiler to you for such a project.
-
Both the MinGW and MSVC projects produce working code when compiled with the proper toolchain.
Must QtCreator have been built by the desired tool chain?
I installed from QtSdk-offline-win-x86-v2_2_1.exe. I can see the MinGW toolchain in the installation. I have uninstalled and reloaded several times, all from that .exe, and with one of the installations I got good build of the MinGW project. I'm reinstalling on a fresh computer now so I can make notes on installation options but I know that the current installation builds the MSVC program properly and, although I see the MinGW options in QtCreator, I cannot make it build the MinGW program.
-
Ok, gentlemen.
The problem was selecting the 'default' installation. This time I did the non-default and made selections for MinGW where needed. Now it all works and I can switch between my MinGW project and my MSVC projects as advertised.
Thanks for the patience.
Richard
-
bq. Both the MinGW and MSVC projects produce working code when compiled with the proper toolchain.
Yes, both compilers will produce working code. But the result of the compiler run linked against the Qt libraries you have installed will only work if the Qt libraries were built with the same compiler.
This is why we will only offer the compilers that are known to be compatible with the Qt version you use when building your project.
If you are using a MSVC-built Qt in one build configuration, then you will be offered MSVC tool chains only in this builtconfiguration. Once you switch to using a Mingw-built Qt you will only get Mingw compilers for that build configuration.