Code::Blocks Forums

User forums => Help => Topic started by: HaraldS on January 22, 2019, 01:05:05 am

Title: CB 17.12 with GCC 5.1.0 and QT5.12.0: how to make QT run in CB?
Post by: HaraldS on January 22, 2019, 01:05:05 am
Hello world,

I'm on Windows 7 (yes, still  ;)) running a freshly installed CB 17.12. Console applications can be compiled flawlessly. The QT 5.12.0 is also freshly installed. Now I want to write a Qt application.

When creating a QT 5 project, I'm being asked "Please select the location of Trolltech QT5. This is the top-level folder where Qt5 is installed. To help you, this folder must contain the subfolders "include" and "lib"." The default folder is to E:\MyProgrammingDir\Qt\5.12.0\mingw73_64 . This is contradictory, because that's not Qt5's top level folder. But indeed,  there are "include" and "lib" folders contained.

Question: why is there obviously a complete MinGW 64 bit compiler in Qt5 (the mingw73_64), while at the same time my CodeBlocks compiler is the 32 bit GCC 5.1.0? My compiler toolchain executable points to E:\MyProgrammingDir\CodeBlocks\MinGW . Shouldn't CodeBlocks and Qt5 use the same compiler?

If I try to compile a Qt5 project, the compile process stops giving "This file requires compiler and library support for the ISO C++ 2011 standard."

How can I fix that?
Do I have to ask in a Qt forum? I do think that the problem is getting CB and Qt work together, that's why I start in this forum.

Thanks guys.

Harald
Title: Re: CB 17.12 with GCC 5.1.0 and QT5.12.0: how to make QT run in CB?
Post by: LETARTARE on January 22, 2019, 10:56:53 am
@Haralds
You must define a new compiler in 'Setting-> Compiler...' which points to
Quote
'E:\MyProgrammingDir\Qt\tools\mingw73_64'
and for include and libraries you must define paths with global variables in 'Setting->Global variables...' like 
Quote
#qt5120 = 'E:\MyProgrammingDir\Qt\5.12.0\mingw73_64'

C::B can only compile very simple Qt applications.

If a 'xxx.h' QT file contains 'Q_OBJECT', it requires the creation of additional 'moc_xxx.cpp' files by calling a specific QT binary (before compilation). Similarly, the '*.ui' and '*.qrc' files must generate add-in files (before compilation).
When all these add-in files have been generated, we can start the compilation in C::B.

For this I wrote a plugin in the finalization phase : http://wiki.codeblocks.org/index.php/QtPregenForCB_plugin (http://wiki.codeblocks.org/index.php/QtPregenForCB_plugin).
The project is in :https://github.com/LETARTARE/QtPregen (https://github.com/LETARTARE/QtPregen) and contains an example for Qt5.

Under Windows I only tested under 'VISTA Business SP2' and 'Qt5.9.6' max (Gcc 5.3.0).



Title: Re: CB 17.12 with GCC 5.1.0 and QT5.12.0: how to make QT run in CB?
Post by: HaraldS on January 22, 2019, 01:20:06 pm
Thanks a lot - I‘ll check that out!