Search code examples
qtqt-creator

No header generated with uic


QtCreator doesn't want to create my ui header file. When I enter uic in the terminal it says me this :

louis@Krusty:~$ uic
uic: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/uic': No such file or directory

I have Qt5 installed in my home folder, Qt recognized it without issue. In the settings, it's in the good folder. Normaly it shouldn't has any problem ! But it has, so I have to create my form by hand :

./.Qt/5.5/gcc_64/bin/uic Documents/lab/Qt/OpenPlane/AirplaneEditor.ui  -o ui_AirplaneEditor.h

This is my QMake :

QT += widgets

SOURCES += \
    main.cpp \
    Airplane.cpp \
    AirplaneOverview.cpp \
    AirplaneManager.cpp \
    AirplaneEditor.cpp

HEADERS += \
    Airplane.h \
    AirplaneOverview.h \
    AirplaneManager.h \
    AirplaneEditor.h \
    ui_AirplaneEditor.h # By hand

FORMS += \
    AirplaneEditor.ui

If you need more informations, ask me!


Solution

  • From the usefull comments from @bibi:

    Looks like your PATH does not include ~/.Qt/5.5/gcc_64/bin/, and/or not before the regular paths. As bibi said, what is the output of "which qmake uic"?

    Type on a terminal:

    export PATH=$HOME/.Qt/5.5/gcc_64/bin/:$PATH
    

    (some others path may be needed) and then run agin from this terminal. If it does the trick add this PATH addition to you ~/.bashrc to make it permanent.

    But the root problem as I see it is why did you installed Qt5 manually??? (and why in hidden directory?) I you do really need a custom version of Qt, that would not be installed among your system files, a better install place could be /opt. Plus the matching PATH settings explained above.

    If you do not need a custom Qt, every Linux distro can happily install Qt4 and Qt5, and you can then chose which version to use in your .pro file as is exemplified here:

    How to check the selected version of Qt in a .pro file?

    EDIT:

    "I installed it with the official installer from Qt. How should I install it on Ubuntu 15.10?"

    The regular way is definitely not to install it from some Qt's archive. You have a distribution with packagers/maintainers, you should trust them. So for a Qt4 install that would be sudo apt-get install qt-sdk. For Qt5 I don't know, but a bit of apt-cache search qt5 and/or googling should do the trick.

    EDIT 2:

    For a Qt5 install, at least on my virtualbox Ubuntu 14-04 (I run Debian), the base package would be something like qtbase5-dev:

    jbmaillet@jbmaillet-VirtualBox:~$ apt-cache show qtbase5-dev
    Package: qtbase5-dev
    Priority: optional
    Section: libdevel
    Installed-Size: 15557
    Maintainer: Ubuntu Developers <[email protected]>
    Original-Maintainer: Debian Qt/KDE Maintainers <[email protected]>
    Architecture: amd64
    Source: qtbase-opensource-src
    Version: 5.2.1+dfsg-1ubuntu14.3
    Depends: libgl1-mesa-dev | libgl-dev, libgles2-mesa-dev | libgles2-dev, libglu1-mesa-dev | libglu-dev, libqt5concurrent5 (= 5.2.1+dfsg-1ubuntu14.3), libqt5core5a (= 5.2.1+dfsg-1ubuntu14.3), libqt5dbus5 (= 5.2.1+dfsg-1ubuntu14.3), libqt5gui5 (= 5.2.1+dfsg-1ubuntu14.3), libqt5network5 (= 5.2.1+dfsg-1ubuntu14.3), libqt5printsupport5 (= 5.2.1+dfsg-1ubuntu14.3), libqt5sql5 (= 5.2.1+dfsg-1ubuntu14.3), libqt5test5 (= 5.2.1+dfsg-1ubuntu14.3), libqt5widgets5 (= 5.2.1+dfsg-1ubuntu14.3), libqt5xml5 (= 5.2.1+dfsg-1ubuntu14.3), qt5-qmake (= 5.2.1+dfsg-1ubuntu14.3), qtbase5-dev-tools (= 5.2.1+dfsg-1ubuntu14.3), qtchooser
    Pre-Depends: dpkg (>= 1.15.6~)
    Recommends: libqt5opengl5-dev (= 5.2.1+dfsg-1ubuntu14.3)
    Suggests: libmysqlclient-dev, libpq-dev, libsqlite3-dev, unixodbc-dev
    Filename: pool/main/q/qtbase-opensource-src/qtbase5-dev_5.2.1+dfsg-1ubuntu14.3_amd64.deb
    Size: 1643142
    MD5sum: 151188294e4ff90f89b97c4a54c30c62
    SHA1: 5b78fac44f570852a1feb1a7c56ab1dd1a0aa7dc
    SHA256: dc66f32450d2b38766d480982c4c17849cac820d461b7b2bb699045323eb91e6
    Description-en: Qt 5 base development files
     Qt is a cross-platform C++ application framework. Qt's primary feature
     is its rich set of widgets that provide standard GUI functionality.
     .
     This package contains the header development files used for building Qt 5
     applications.
    Description-md5: b1a4d90909152c53a52db6116d1f19f9
    Multi-Arch: same
    Homepage: http://qt-project.org/
    Bugs: https://bugs.launchpad.net/ubuntu/+filebug
    Origin: Ubuntu
    Supported: 9m
    
    Package: qtbase5-dev
    Priority: optional
    Section: libdevel
    Installed-Size: 15561
    Maintainer: Ubuntu Developers <[email protected]>
    Original-Maintainer: Debian Qt/KDE Maintainers <[email protected]>
    Architecture: amd64
    Source: qtbase-opensource-src
    Version: 5.2.1+dfsg-1ubuntu14
    Depends: libgl1-mesa-dev | libgl-dev, libgles2-mesa-dev | libgles2-dev, libglu1-mesa-dev | libglu-dev, libqt5concurrent5 (= 5.2.1+dfsg-1ubuntu14), libqt5core5a (= 5.2.1+dfsg-1ubuntu14), libqt5dbus5 (= 5.2.1+dfsg-1ubuntu14), libqt5gui5 (= 5.2.1+dfsg-1ubuntu14), libqt5network5 (= 5.2.1+dfsg-1ubuntu14), libqt5printsupport5 (= 5.2.1+dfsg-1ubuntu14), libqt5sql5 (= 5.2.1+dfsg-1ubuntu14), libqt5test5 (= 5.2.1+dfsg-1ubuntu14), libqt5widgets5 (= 5.2.1+dfsg-1ubuntu14), libqt5xml5 (= 5.2.1+dfsg-1ubuntu14), qt5-qmake (= 5.2.1+dfsg-1ubuntu14), qtbase5-dev-tools (= 5.2.1+dfsg-1ubuntu14), qtchooser
    Pre-Depends: dpkg (>= 1.15.6~)
    Recommends: libqt5opengl5-dev (= 5.2.1+dfsg-1ubuntu14)
    Suggests: libmysqlclient-dev, libpq-dev, libsqlite3-dev, unixodbc-dev
    Filename: pool/main/q/qtbase-opensource-src/qtbase5-dev_5.2.1+dfsg-1ubuntu14_amd64.deb
    Size: 1645270
    MD5sum: 5a34acc6541815677e4c352e434b1bec
    SHA1: a1944357caa86a218909eb5323ed2d94fa7b77fe
    SHA256: dade051dcb2f3dac311bfcfe552513d74be14b5d638946980d495c84310d866b
    Description-en: Qt 5 base development files
     Qt is a cross-platform C++ application framework. Qt's primary feature
     is its rich set of widgets that provide standard GUI functionality.
     .
     This package contains the header development files used for building Qt 5
     applications.
    Description-md5: b1a4d90909152c53a52db6116d1f19f9
    Multi-Arch: same
    Homepage: http://qt-project.org/
    Bugs: https://bugs.launchpad.net/ubuntu/+filebug
    Origin: Ubuntu
    Supported: 9m
    

    Look at the list of dependencies it will install: qt5-qmake, qtbase5-dev-tools, the libs etc.

    So apt-get install that, plus latter on maybe a few more packages depending on the type of Qt5 app you want to develop (ex Qt5 with dbus or this or that).