QtCreator不想创建我的ui头文件。当我在终端输入uic
时,它会告诉我:
louis@Krusty:~$ uic
uic: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/uic': No such file or directory
我在我的主文件夹中安装了Qt5,Qt认出它没有问题。在设置中,它位于好文件夹中。 Normaly它不应该有任何问题!但它有,所以我必须手工创建我的表格:
./.Qt/5.5/gcc_64/bin/uic Documents/lab/Qt/OpenPlane/AirplaneEditor.ui -o ui_AirplaneEditor.h
这是我的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
如果您需要更多信息,请问我!
答案 0 :(得分:2)
来自@bibi的有用评论:
您的PATH看起来不包含~/.Qt/5.5/gcc_64/bin/
,和/或不在常规路径之前。正如bibi所说,“which qmake uic
”的输出是什么?
在终端上输入:
export PATH=$HOME/.Qt/5.5/gcc_64/bin/:$PATH
(可能需要其他一些路径)然后从此终端运行agin。
如果确实如此,请将此PATH添加添加到~/.bashrc
以使其永久化。
但我看到的根本问题是为什么你手动安装了Qt5 ??? (以及隐藏目录中的原因?)我确实需要一个自定义版本的Qt,它不会安装在您的系统文件中,更好的安装位置可能是/opt
。加上上面解释的匹配PATH
设置。
如果您不需要自定义Qt,每个Linux发行版都可以愉快地安装Qt4和Qt5,然后您可以选择在.pro
文件中使用哪个版本,如下所示:
How to check the selected version of Qt in a .pro file?
编辑:
“我是用Qt的官方安装程序安装的。我该怎么办? 在Ubuntu 15.10上安装它?“
常规方式绝对不是从某些Qt的档案中安装它。你有一个包装商/维护者的分销,你应该信任他们。所以对于Qt4安装,sudo apt-get install qt-sdk
。对于Qt5,我不知道,但有点apt-cache search qt5
和/或谷歌搜索应该做的伎俩。
编辑2:
对于Qt5安装,至少在我的虚拟机Ubuntu 14-04(我运行Debian)上,基本包就像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
查看它将安装的依赖项列表:qt5-qmake,qtbase5-dev-tools,libs等。
所以apt-get install
,根据你想要开发的Qt5应用程序的类型,加上后者可能还有几个包(例如Qt5与dbus或者这个或那个)。
答案 1 :(得分:0)
我遇到了同样的问题。我的所有Qt5软件包都已安装,但我的linux(CentOS)系统上找不到uic
,但uic-qt5
是!
因此执行以下操作对我有用:
$ uic-qt5 AirplaneEditor.ui -o ui_airplaneeditor.h