PDA

View Full Version : Using MinGW as compiler in the 5.0 RC 2 windows version of QT



Infinity
16th December 2012, 21:31
Hi,

Because I reinstalled my windows operating system, I updated to the latest version of the Qt Libraries. I downloaded the 5.0 RC 2 version from this website:
http://qt-project.org/downloads

As I wanted to compile one of my projects, I noticed that the MinGW compiler isn't included (in contrast to the previous versions of Qt). I downloaded the lastest version of MinGW, but I don't know how to integrate it in Qt Creator. I already tried to add MinGW as a compiler (I chose "D:\MinGW\bin\gcc.exe" as executable.). Is that the correct way of including an Compiler to Qt Creator? It seems to work, but the problem is, that all the Qt Header Files are missing. Where do I find them and how can I setup MinGW to use them?

By the way, the Linux version of Qt 5.0 RC 2 supports GCC by default. I'm wondering why there's no Qt version for windows, that supports MinGW - the windows port of GCC - by default?

ChrisW67
16th December 2012, 23:19
The Qt Libraries have never included the MingW compiler.

There is a Qt SDK that includes a Qt Creator, some Qt libraries, and MingW tool chain including GCC 4.4. For released versions of 4.x (since the Qt SDK came into being) there has been a precompiled set of libraries using that old g++ 4.4 version so it could slot into the Qt SDK. Nobody has done that for the unreleased version of Qt5 because the minimum compiler version for MingW is 4.7.

If you are using Qt Creator 2.5.x then the available Qt versions and tool chains (specified by location of g++) are defined in the Tools, Options... dialog under Build & Run. Your Creator Project puts the two together and they need to match.

If you are using Qt Creator 2.6 then you need to create a Kit of the compiler and Qt version and then set your Project to use it.

Zlatomir
17th December 2012, 08:15
Only info i got is this comment (http://blog.qt.digia.com/blog/2012/12/13/qt-5-0-rc2-released/#comment-116858) - so maybe Qt 5.0 will come with binaries built with MinGW and VS 2012 too, if not 5.0.1 will have those.

Anyway, on top of what ChrisW67 said, you will also need to build Qt framework with MinGW (because the already built binaries that you installed are built using VS 2010) - you can find the source code at the same download location you mentioned.

Infinity
17th December 2012, 21:01
Thanks for your help. I will try what you suggested.

Infinity
15th January 2013, 19:36
I've resumed to deal with this topic again. I compiled the Qt Library with MinGW now. I think the compilation was successful, but now I want to build Qt Creator using my self compiled Qt Library.

The problem is, that the compilation of Qt Creator is incomplete.

I'm using the following command line to create the make file:

D:\Qt\qt5_creator\build>qmake d:\qt\qt5_creator\source\qtcreator.pro
Do I need to create make files for the other sub projects in the source directory, too?

Then I run MinGW:


D:\Qt\qt5_creator\build>mingw32-make release
......
LD:/Qt/qt5_creator/build2/libs/extensionsystem/lib/qtcreator -lAggregation -LD:/
Qt/qt5/qtbase/lib -lQt5Widgets -lQt5Concurrent -lQt5Gui -lQt5Core
d:/qt/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw
32/bin/ld.exe: cannot find -lAggregation
collect2.exe: error: ld returned 1 exit status
Makefile.Release:112: recipe for target 'lib\qtcreator\ExtensionSystem.dll' fail
ed
mingw32-make[2]: *** [lib\qtcreator\ExtensionSystem.dll] Error 1
mingw32-make[2]: Leaving directory 'D:/Qt/qt5_creator/build/libs/extensionsyste
m'
Makefile:48: recipe for target 'release' failed
mingw32-make[1]: *** [release] Error 2
mingw32-make[1]: Leaving directory 'D:/Qt/qt5_creator/build/libs/extensionsyste
m'
makefile:438: recipe for target 'sub-libs-extensionsystem-sub_Release_ordered' f
ailed
mingw32-make: *** [sub-libs-extensionsystem-sub_Release_ordered] Error 2


The compilation of "qtcreator.exe", "Aggregation.dll" and "ExtensionSystem.dll" has been working, but as you can see, I'm getting errors and the compilation isn't complete.
Do you know, what's the reason for this errors? Do I need to set an additional path? I already added the following directories:


D:\Qt\qt5_creator>echo %PATH%
D:\Qt\qt5\qtbase\bin;
D:\Qt\qt5\gnuwin32\bin;
D:\Qt\mingw\bin;D:\Qt\strawberry-per
l-5.16.2.1-64bit\perl\bin;
"D:\Python 2.7.3";
D:\Qt\ruby-1.9.3-p362-i386-mingw32\r
uby-1.9.3-p362-i386-mingw32\bin;
D:\Qt\qt5_deps\icu\dist\lib;
D:\Qt\qt5_deps\opens
sl-1.0.1c\dist\bin;
D:\Qt\PortableGit-1.8.0-preview20121022\cmd;
C:\Windows\System
32;D:\Qt\qt5_creator\source\src\plugins;
D:\Qt\qt5_creator\source\src\libs;
D:\Qt\
qt5_creator\source\src\plugins\tools;
D:\Qt\qt5_creator\source\src\app


It would be nice, if someone knows, what I've forgotten to do :-)

EDIT: I also tried to run configure.bat (I'm not sure how I have to use it), but then the compilation doesn't work, too.