How to force Qt Creator to use MinGW instead of Visual Studio - qt

We're trying to compile a project with MinGW on the machine that has both MinGW (with Qt) and Visual Studio installed. Unfortunately, Qt creator prefers MSVS by default, and doesn't see it's very own MinGW (screenshot). Sadly, this results in a lot of obscure errors, because application was written and debugged with MinGW. Is there way to make Qt Creator to use MinGW without killing MSVS?

While installing, choose custom type of installation. Selected libraries for needed compilers in QtSDK->Development Tools->Desktop Qt->Qt-. Screenshot:

Have you made sure your Qt sdk is installed with its MinGW? You can use the Qt maintainance app to make sure its MinGW engine is installed.

Where are those libraries from? Did you compile the SDK yourself? Or did you downloded the libraries?
Try to see what is in the mkspecs directory. There should be a link named 'default'. That links to the specification which is being used. I suppose it is pointing to win32-msvc2008. You can change that but if it is pointing to that specification it means that the Qt libraries have been compiled with that specification (unless it was changed afterwards), which means you cannot use those with MinGW. You should compile the libraries with the correct specification or download the correct package (MinGW version).

Related

Qt5 Issues: error: shell32.lib: No such file or directory

I'm trying to learn how to use Qt for dev and have to say it's been a pain from the start.
I installed Qt Creator 5.4 version. Then followed this http://qt-project.org/wiki/Qt_for_beginners_Hello_World.
It defaulted to MSVS so I manually added MinGw. It has a red sign next to it saying that MinGW cannot compile code for the QT version.
I just want to use Qt5 and need an appropriate compiler for it. I'm used to using MinGW in Eclipse for C++ dev.
Your installation seems to be incomplete or inconsistent.
To work with Qt you actually need two things: One is a compiler toolchain (called the "kit" in Qt Creator), the other is the compiled Qt library, which is what is visible in settings under "Qt versions". Both need to fit together for Qt to work.
In case you want to use Qt with Visual Studio, you should select the precompiled Qt version corresponding to your (previously installed) VS version during install when you use the online installer. Or use the offline installer for your VS version. After install, everything finds together itself.
Or you want to use MinGW. Do yourself a favor and use the MinGW version which is installed by the Qt installer, which is different to the one from MinGW.org (it is the 32 bit version of the MinGW-w64 project, which is more up to date than the one from MinGW.org, and has some other subtleties). It is selectable in the installer under "tools". Additionally select the Qt version precompiled with MinGW. After install, select the MinGW Kit for your new project, and everything again will work from scratch. Again, you can use either the offline installer including MinGW-precompiled Qt or the online-installer which has all versions of precompiled selectable to perform that installation.

Installing Qt Creator with MinGW

So it looks like with Digia taking Qt over from Nokia, that it's quite a mess to get a few simple downloads.
If I now go to the downloads page (http://qt-project.org/downloads), I see that there's a single Qt Creator 2.6.2 download for Windows. When I download this and run the installation, it seems that MinGW is no longer packaged along with it.
I tried to install MinGW 4.4 separately and then add a toolchain, but nothing runs when I try to compile my CMake-based project.
I then came across the Nokia website that is offering Qt SDK 1.2.1; however it now looks that they require you to create an account to be able to download the installer.
Downloading the full set of Qt libraries is probably what is going to be suggested, but that's not the best idea, because I'm basically writing up an installation procedure for a CMake-based, open-source set of libraries that I've been working on for a while (http://tudat.tudelft.nl).
Users aren't happy with having to download all the Qt libraries, since we're not using any of them.
I've completely run out of solutions now (and mind you, this only seems to be a problem for Windows, since when I install Qt Creator on Linux and Mac, GCC auto-detection seems to work fine).
So, in short, does someone have a simple install routine to install Qt Creator and get it to work with MinGW to compile a CMake-based project?
Thanks in advance!
Kartik
PS: I know there are plenty of threads on Qt Creator + MinGW, but they all seem to be outdated now with the recent changes on both the Digia and Nokia websites.
I should add that the problem specifically is not that the toolchains can't be auto-detected under Windows. I've managed to get both MinGW and CMake auto-detected by Qt Creator by adding both to the system path. The problem is that when I then try to open the CMakeLists.txt file for my project, I can't select any generators.
Straight forward:
Install Qt Framework
Install MinGw
Install CMake
Install other stuff, e.g. git
Install Qt Creator
As you already mentioned, the chances are good that Qt Creator gets everything via auto detect. Nevertheless, you should check the Qt settings if everything is in place, e.g. the debugger.
The first time you open a cmake project, Qt Creator (should) ask for the tool chain to use. If you want to change the chain afterwards, delete the build files and cmake directories.
More details to Qt Creator and cmake: http://qt-project.org/doc/qtcreator-2.7/creator-project-cmake.html

Qt SDK download for MingW

I´m looking for Qt SDK for windows that uses MingW as the compiler. Unfortunately, on the official download sites, I can only find the one that uses MSVC. Or just the library instead of the whole SDK.
Can anybody tell me where I can find the version I am looking for, or explain what I should do if I download QT library, QT creator and MingW seperately?
Here you can find pre-release builds using MinGW 4.7.
http://releases.qt-project.org/digia/5.0.1/latest/
They work well with the MinGW builds distributed here:
http://sourceforge.net/projects/mingwbuilds/
The Qt builds come with Qt Creator, so you can install it and should be good to go after setting up your kits.
You can find binaries here:
http://qt-project.org/forums/viewthread/23002/
But then you ought to reconfigure installation manual or you may use this utility.
Some guy from Digia promised MinGW builds by the end of January, so you can wait instead.

Xerces Library and Qt

I'm trying to setup xerces so that I can use it in Qt Creator for Windows.
Does Qt support windows/linux binaries or do I have to compile it using mingw as a target? How one goes about compiling those libraries in Windows?
No, you can't use libraries compiled for Linux under Windows. You'll have to either build it yourself or use existing Windows binary distribution. How that works in detail depends on the third-party library you want to use. The basic options are, in case you have to build it yourself: build it with MSVC under Windows, with mingw under Windows, or cross-compile it with mingw from e.g. Linux. MSVC tends to be less hassle under Windows, but mingw might just work as well.
Important: mingw and MSVC are ABI-incompatible when it comes to C++ libraries. You can't use e.g. a MSVC-built xerces in your mingw-Qt project, or a mingw-Xerces in an MSVC project. That only affects C++ libraries, not pure C ones.

dumpbin equivalent in Qt

Is there any utility similar to dumpbin(Visual Studio) in Qt that allows me to check the functions that are exposed in a Qt-Creator compiled dll ??
I need to know what methods are exposed in a given dll so that I can load the method dynamically at runtime using QLibrary.
Thanks,
De Costo
You can use Dependency Walker. It is a very useful tool for any executable file, whether it's a dynamic library or an application.
Also, nothing prevents you from compiling with VC++ in Qt Creator (Qt Creator supports GCC and VC++ as compilers, maybe more) and using dumpbin, too.
On Linux and Mac, use nm
On Windows, you can use nm via Cygwin, but I think dumpbin will still work. (I just tried it on a project compiled with g++ via Qt Creator, and it worked.)
Either:
use an existing MS Visual Studio installation and its dumpbin.exe
install the Windows SDK (only the Win32 dev tools) and use its dumpbin.exe
learn to use the mingw/GCC (actually binutils) nm and objdump.
I find that (even with mingw/gcc) the dumpbin.exe provides the best results.

Resources