Qt 4.7.4 and minGW 4.7.2 libs - qt

I have 2 different projects build with MinGW 4.7.2 using CMake and I need to link these to a Qt graphical app. Qt version is 4.7.4. OS is Windows 8 64bits.
The problem is that when I try to compile I get a huge amount of undefined references. After some research, I think it's because my version of Qt use minGW 4.4. Is that correct ?
Is there any way I could make the app work with my current configuration ?
If not, is there a different version of Qt that could work ? From what I saw the only option is to compile Qt with minGW 4.7.2. I tried and got errors when building it so if there's an easier way to make things work it would be great.
I also tried to compile my 2 projects with MinGW 4.4 but it crashs when i execute them so I have to keep MinGW 4.7.2 since I don't plan on doing more modifications to these 2 projects.
Also, as of now I use the mingw from mingw.org on a 64 bits laptop. I haven't got any problem because of that since now but maybe i should change to one of the mingw64 alternative ?

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.

Compiling Qt5: Adding a postfix to the Qt libs and dlls (-qtlibinfix)

I am in the process of upgrading from Qt4 to Qt5.
When I compiled the Qt4 sources I used to configure like this:
configure –qtlibinfix _64_
We did this for the x64 build so that the resulting Qt dlls would be renamed QtCore_64_.dll etc...
We are supporting both 64 and 32 bit builds and this made it a lot easier for us.
However, now with Qt5 it seems the -qtlibinfix option is gone. Is there an equivalent? Or another way a similar thing can be accomplished.
I have been scouring the Qt doc, and I have not found anything yet. Any help would be appreciated.
I'm also porting an app from Qt4 to Qt5. -qtlibinfix works for me as expected on Windows, building Qt 5.4.0.

Linking error because of different versions MSVC and Qt libraries

I am having trouble with compiling a Qt project using the MSVC 2012 compiler. I downloaded Qt first, then realised I didn't have a proper compiler yet, and then downloaded Microsoft Visual Studio Express 2012 and its msvc compilers.
However, whenever I try to compile something in Qt Creator, it gives the following error:
qtmain.lib(qtmain_win.obj):-1: LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match with value '1700' in glwidget.obj
So my understanding of what this means is that my Qt libraries are of a different (older) version than my msvc compiler. But I am not sure how to fix it, or how to get other/newer libraries. Some googling told me that the following code added to the Qt .pro file should solve things:
QMAKE_COMPILER_DEFINES += _MSC_VER=1700 WIN32
But that didn't have any effect. Also, using '1600' instead of '1700' didn't help. Any ideas on what will?
I am working on a 32-bit Windows 7 system, if that's any help, and I'm using Qt 5.0.0.
You need binaries compiled for the Visual Studio 2012. Since there is no official (or unofficial) precompiled binaries available, you need to compile them by yourself.
This should not be complicated process, but it can be hard and frustrating for beginners to do to it, so I would suggest you to follow already given advice and to download VS2010 (afterall, it will take less time to download and install it than to compile Qt from source).
You have to use MSVC 2010, because the libraries are built using it. Try Visual C++ 2010 Express.

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

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

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).

Resources