Unable to install "Uncrustify" C++ Beautifier in Qt Creator

  • QtCreator (3.01, Ubuntu 14.04 LTS) allows the installation of C++ code Beautifier "Uncrustify", for reformatting existing code. This all looks simple from instructions here at http://doc.qt.io/qtcreator/creator-beautifier.html, but I am stuck on basic inability to install.

    I have downloaded, compiled and installed the latest uncrustify-0.61. This creates the executable etc. fine, and installs in system area.

    The instructions then state:

    Select Help > About Plugins > C++ > Beautifier to enable the plugin.

    Well, there is no "Beautifier" plugin showing under C++. Hardly surprising, since building/installing "Uncrustify" does not do anything to "tell" Qt Creator it is there/available. How do you get Qt Creator to know the plugin is available to Load?

    In have searched everywhere on the web for help. My guess is that in directory /usr/lib/x86_64-linux-gnu/qtcreator/plugins/QtProject there needs to be a file like Uncrustify.pluginspec (plus anything else), but there is no mention of this. I have scoured the web for anything to show how to actually install and make it work, but found nothing more than the instructions above, which do not work.

    I have spent hours on this, and am so frustrated. Since I have seen posts here implying some people have this working in Qt Creator, could someone please explain precisely what you have to do to get it installed?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Which version of Qt Creator are you using ?

  • Thank you for your welcome. I wish you had been here yesterday while I was tearing my hair out! :) Your question is indeed to the point, and I am posting my finding/answer here now...

  • Well, turns out this is an issue for the C++ Beautifier plugin in general rather than "Uncrustify" in particular, and a Qt Creator version-too-old.

    The files required are Beautifier.pluginspec and libBeautifier.so.

    Although I was being directed to the "Beautifier" Help from the Qt Creator Version 3.0.1 which gets installed from the Ubuntu 14.04 LTS Software Centre, Beautifier support was only introduced at Qt Creator 3.1 --- though that is hard to discover from web searching.

    So at Ubuntu 14.04 LTS, either Beautifier is simply not available by default, or you can go replace the shipped 3.0.1 Qt Creator with an Open Source 3.1+, or maybe just pick those 2 files out of a 3.1 distribution/installation and see if they work OK under 3.0.1.

  • @SGaist said:

    Hi and welcome to devnet,

    Which version of Qt Creator are you using ?

    Given that the Beautifier Help I was accessing is at http://doc.qt.io/qtcreator/creator-beautifier.html, how would I know that only applies from Qt Creator 3.1 onward? If I am (like many others) using the Qt Creator 3.0.1 that ships/installs with Ubuntu 14.04 LTS, is there a different Url for online and still-accessible Qt Creator Help as it was for an older version like 3.0.1?

  • Lifetime Qt Champion

    The online documentation has the current version number of Qt Creator on the right, just under the search input field.

    I don't know whether old versions of Qt Creator's documentation are still available however, you should already have the documentation provided with Qt Creator that is accessible from the help panel.

  • @SGaist
    Thank you.

    I have tried to run the Beautifier plugin, fetched from Open Source Qt Creator 3.1.0, against the installed Qt Creator 3.0.1 that ships with Ubuntu 14.04 LTS, but the libBeautifier.so is indeed incompatible.

    2 questions:

    • How tied in are the Qt Creator versions to the Qt itself versions? For example, Qt Creator 3.1.0 seemed to run fine with my existing Qt 5.2.1 which shipped with Qt 3.0.1, but is that lucky/dangerous, am I expected to change Qt version if I change Qt Creator version?
    • Do you/anyone here happen to know what version of Qt/Qt Creator will be supplied with the forthcoming Ubuntu 16.04 LTS Release? I do not know who decides that.

  • Lifetime Qt Champion

    1. You should be able to change Qt versions forward and backward. Only exception is if you are using a feature available only since e.g. 5.2.0 then that would be the minimal version.
      However plugins may behave differently, it's only backward within a major release.

    More details here

    1. That's a question for the Qt Creator package maintainer. AFAIK, you have that information on the package page on packages.ubuntu.com.

  • Moderators

    Alternatively, you can get the standalone Qt + Qt Creator package from http://www.qt.io/download-open-source/ -- you don't need to wait for the distro packagers to catch up.

    The latest versions are Qt 5.5 and Qt Creator 3.6.0

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.