![未找到 QtCore](https://linux22.com/image/882585/%E6%9C%AA%E6%89%BE%E5%88%B0%20QtCore.png)
我在安装方面遇到了问题 - 当我想使用cmake
QtCore 编译 KeePassX 时出现错误。我尝试安装 libqtcore,得到了E: Unable to locate package libqt4-core
编译 KeePassX 的输出:
cmake [-DCMAKE_INSTALL_PREFIX=/usr/local] ..
-- The C compiler identification is GNU 5.3.1
-- The CXX compiler identification is GNU 5.3.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test WERROR_C_AVAILABLE
-- Performing Test WERROR_C_AVAILABLE - Success
-- Performing Test WERROR_CXX_AVAILABLE
-- Performing Test WERROR_CXX_AVAILABLE - Success
CMake Warning at /usr/share/cmake-3.5/Modules/FindQt4.cmake:626 (message):
/usr/bin/qmake reported QT_INSTALL_LIBS as "/usr/lib/x86_64-linux-gnu" but
QtCore could not be found there. Qt is NOT installed correctly for the
target build environment.
Call Stack (most recent call first):
CMakeLists.txt:151 (find_package)
CMake Error at /usr/share/cmake-3.5/Modules/FindQt4.cmake:634 (message):
Could NOT find QtCore. Check
/home/mike/Downloads/keepassx-2.0.2/build/CMakeFiles/CMakeError.log for
more details.
Call Stack (most recent call first):
CMakeLists.txt:151 (find_package)
-- Configuring incomplete, errors occurred!
尝试使用以下命令安装 Qt 后的输出sudo apt install libqtcore4
:
sudo apt install libqtcore4
[sudo] password for mike:
Reading package lists... Done
Building dependency tree
Reading state information... Done
libqtcore4 is already the newest version (4:4.8.7+dfsg-5ubuntu2).
libqtcore4 set to manually installed.
The following packages were automatically installed and are no longer required:
ca-certificates-mono cli-common kde-l10n-cs kde-l10n-engb
libmono-corlib2.0-cil libmono-corlib4.5-cil libmono-i18n-west4.0-cil
libmono-i18n4.0-cil libmono-security4.0-cil
libmono-system-configuration4.0-cil libmono-system-security4.0-cil
libmono-system-xml4.0-cil libmono-system4.0-cil libmonoboehm-2.0-1
libpkcs11-helper1 mono-4.0-gac mono-gac mono-runtime mono-runtime-common
mono-runtime-sgen mono-utils openvpn stunnel4
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
今天我在 Google 上搜索了一下,找到了以下三个命令,但我不知道如何准确编写它们:
export QTDIR="/path/to/qt-5.0.1" export PATH="${QTDIR}/bin:${PATH}"
这个变量在使用 cmake 时可能会有用:
export CMAKE_PREFIX_PATH="${QTDIR}"
它将 Qt 的路径添加到 Cmake 的搜索路径。
答案1
尝试安装 libqt4-dev 来安装 Qt4 开发文件。