Ask Your Question

How to get started with Qt programming in C++ with Code::Blocks?

asked 2018-07-04 14:32:42 -0500

Santosh gravatar image

I have installed Code::Blocks. I also tried running file from the official site, but the installer hangs after reaching a certain amount of percentage.

How do I install Qt header files so I can develop from Code::Blocks? It's okay if I also get QtCreator. I'll also try that IDE.

Are those in Fedora repositories? What dnf packages I need to install?

edit retag flag offensive close merge delete

5 Answers

Sort by ยป oldest newest most voted

answered 2018-07-05 12:37:28 -0500

fcomida gravatar image

updated 2018-07-05 12:41:01 -0500

Includes are under /usr/include/qt5. Getting a Qt application to compile and link depends on how Code::Blocks sets up a project and which build systems it supports (qmake, CMake, plain Makefile, others?). You should read Code::Blocks documentation. In Fedora there are some packages with Qt example code which use qmake: qt5-qtbase-examples is one of them. Install it and copy the code in a directory under $HOME. Try to build some of the examples from the command line first, you might find that you must install other packages as well.

$ mkdir src
$ cp -r /usr/lib64/qt5/examples/gui src
$ cd src/gui
$ qmake-qt5
$ make
$ cd analogclock
$ ./analogclock

Then you can try opening ~/src/gui/ in Code::Blocks or something similar.

edit flag offensive delete link more

answered 2018-07-04 19:02:54 -0500

fcomida gravatar image

Qt is a huge framework, it's been splitted among many different packages in Fedora. Depending on whether you are going to develop a classical desktop GUI application or a more modern tablet like UI application you'll need to install different packages. You'll basically need qt5-qtbase qt5-qtbase-gui for classic gui apps or qt5-qtquickcontrols for a slick ui plus the correspondent -devel packages. sudo dnf install qt-creator for installing the official Qt IDE. sudo dnf search qt5 for a list of all Qt5 related packages. Happy hacking with Qt.

edit flag offensive delete link more


Well with these packages installed. Code::Blocks (also the latest version) is not able to find qt5 reference files. Can you please enlighten the path?

Santosh gravatar imageSantosh ( 2018-07-05 10:19:50 -0500 )edit

Question Tools

1 follower


Asked: 2018-07-04 14:32:42 -0500

Seen: 1,459 times

Last updated: Jul 05 '18