Qt Creator for Gtkmm and Automake Projects

In this blog post, you will learn how to use Qt Creator for Automake and Gtkmm project. Yes, you read correctly I will explain how to create Gtk projects with Qt-Creator.

But why?

You may ask two things:

  • How does it come that I work on a Gtkmm + Automake project?

    I currently work on a low-level GUI application for a customer. The GUI runs on a 128×64 OLED display. Qt is also suitable for this application. However, Qt Embedded license fees and the limited complexity of the application make Gtkmm also very attractive.

  • Why should I use Qt Creator for anything else than Qt projects?

    Qt Creator is more than just a Qt IDE. It’s one of the few cross-platform C++ IDEs and in my opinion an excellent one. Besides the standard IDE features like code completion, refactoring tools and debugging it features advanced tools like Clang static code analysis, SCXML statechart modeling, and Valgrind memory analyzer integration. Also very vital for me: It can be customized to use Emacs key bindings (that’s worth another blog post).

How can I get started?

It turned out to be surprisingly easy to set-up Qt Creator for Autotools projects.

First, you need to enable the AutotoolProjectManager plugin in the Help > About Plugins… window. You need to restart Qt Creator for the changes to take effect.

Now you can open any Autotools project using the File > Open File or Project… menu. Select the top-level Makefile.am, then go ahead by choosing a Qt version (you are selecting just the compiler actually).

You can read more about setting up an Autools project in the Qt Creator documentation.

The tricky parts

Although the Qt Creator Autotools setup works pretty well out of the box, there some problems I came across when working on the Gtkmm project.

  • Source and header files do not show up in the project pane

    Qt Creator only knows about source files defined in any Makefile.am. Headers are only presented when they match a source

    **Workaround: ** Use the file system view.

  • Anything other than .cpp and .h files does not show up in the projects pane.
    Unfortunately, it seems the Autotools plugin does not detect any other files than source files.

    Workaround: Use the file system view.

  • Qt Creator does not find all included headers.

    The Autotools plugins scans any -I flags in the makefiles. However, it seems in some cases this does not work correctly.

    Workaround: Qt Creator scans the CPLUS_INCLUDE_PATH environment variable. Either set this variable in the build environment settings of the project or in your .bashrc file.

Conclusion

The Autotools project manager does not work flawlessly. However, the benefits of using Qt Creator overshadow these problems for me.

I especially enjoy the Clang static analysis which Qt Creator runs in the background during coding. This feature really makes C++ coding a charm.

I really can recommend Qt Creator as IDE for Automake projects to anyone looking for an alternative to Eclipse or if you are Qt coder who also needs to work non-Qt projects every once in a while.

If you are looking for an alternative to Qt Creator for Makefile and Automake projects on Linux, I can also recommend you to take a look KDevelop.

Leave a Reply

Your email address will not be published. Required fields are marked *