0

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!

Louis Etienne
  • 1,302
  • 3
  • 20
  • 37
  • What do you mean by _"... doesn't want ..."_? Did you get en error? Also, if doing it manually is okay, so what's your problem? Your question at the moment seems fairly unclear, please [edit](http://stackoverflow.com/posts/35823061/edit) it and elaborate on it in a clear way. – frogatto Mar 06 '16 at 07:07
  • 1
    Are you sure you called the qmake you have installed in your home? what is the output of `which qmake uic` and does the makefile get created? The rule for your ui is correct? – bibi Mar 06 '16 at 07:19
  • 1
    Note: It's a bit strange to install QT in `~/.Qt` it is supposed to be a _hidden_ directory. What os are you on? – bibi Mar 06 '16 at 07:24
  • Okay so `which qmake uic` said me that they are in the `/usr/bin`. Wtf? I installed it with the official installer from Qt. How should I install it on Ubuntu 15.10? – Louis Etienne Mar 06 '16 at 07:55
  • I don't want to generate the header by hand. Normaly it does it automatically! – Louis Etienne Mar 06 '16 at 07:56
  • ok, that's what I was wondering. You have a System installed qt and a manual one. I suggest to keep just one, so uninstall the system one. You can make them work together but it requires some (minimal) skills. Anyway, to compile run the qmake you have in your home. This should be something like `~/.Qt/5.5/bin/qmake` – bibi Mar 06 '16 at 08:02
  • It looks like you have more than one version of Qt installed. The error message seems to be referring to Qt4, not Qt5 – RobbieE Mar 07 '16 at 06:59

3 Answers3

2

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 <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
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 <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
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).

Community
  • 1
  • 1
jbm
  • 3,063
  • 1
  • 16
  • 25
  • Okay, so during you was posting this post, I deleted the `.Qt` and reinstall it. Now I start from a new installation. But it still doesn't work. :( – Louis Etienne Mar 06 '16 at 08:17
  • There is no Qt5 package. I have to install it from official installer (On the Qt5 wiki) – Louis Etienne Mar 06 '16 at 08:22
  • @Wizix trust me, **there are Qt5 dev packages in Ubuntu 15.10 wily** : https://launchpad.net/ubuntu/wily/+package/qt5-default. "Qt 5 development defaults package". So use this instead, else you're on your own and you have a simple PATH problem to begin with, and maybe more troubles latter. – jbm Mar 06 '16 at 08:39
  • @Wizix ...as an example of troubles you'll have latter on by doing such custom install, not only will you need to setup your `PATH`, but also latter on setup a `LD_LIBRARY_PATH` env var to run your app from a shell outside of Qt Creator. No, really, this is not the way to go. – jbm Mar 06 '16 at 08:47
0

I had the same problem. All my Qt5 packages are installed but uic cannot be found on my linux (CentOS) system, but uic-qt5 is!

So executing the following worked for me:

$ uic-qt5 AirplaneEditor.ui -o ui_airplaneeditor.h
jaques-sam
  • 2,578
  • 1
  • 26
  • 24
0

The problem in question disappeared after installing two packages: qtbase5-dev-tools qtbase5-de (Ubuntu 22.04)

macosmi
  • 104
  • 5