我现在在Linux下使用KDevelop for C ++,我想编译一个Qt4应用程序,但是当我这样做时,它会给我以下错误:
我编译:
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Debug /home/myname/projects/First Qt projet/
这些是错误:
-- Configuring incomplete, errors occurred!
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:97 (MESSAGE):
Could NOT find Qt4 (missing: QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE
QT_RCC_EXECUTABLE QT_UIC_EXECUTABLE QT_INCLUDE_DIR QT_LIBRARY_DIR
QT_QTCORE_LIBRARY)
Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:288 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-2.8/Modules/FindQt4.cmake:1200 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:3 (find_package)
我该怎么办?
答案 0 :(得分:13)
sudo apt-get install libqt4-core libqt4-dev libqt4-gui qt4-dev-tools
这应该为你安装qt4:/ usr / lib64 / qt ...从那里cmake
应该能够为你获取qt的位置。
如果命令行不是你的风格,你也可以使用那个Ubuntu包管理器。
答案 1 :(得分:5)
不确定这是否会对任何人有所帮助,但对于Fedora,我遇到了以下问题:
/usr/share/cmake/Modules/FindQt4.cmake:1386中的CMake错误(消息): 从NOTFOUND找到不合适的Qt版本“”,此代码需要Qt 4.x. 呼叫堆栈(最近一次呼叫): bgrive / CMakeLists.txt:3(find_package)
通过FindQt4.cmake后,我发现了这个:
if (NOT QT_VERSION_MAJOR EQUAL 4)
set(VERSION_MSG "Found unsuitable Qt version \"${QTVERSION}\" from ${QT_QMAKE_EXECUTABLE}")
set(QT4_FOUND FALSE)
if(Qt4_FIND_REQUIRED)
message( FATAL_ERROR "${VERSION_MSG}, this code requires Qt 4.x")
else()
if(NOT Qt4_FIND_QUIETLY)
message( STATUS "${VERSION_MSG}")
endif()
endif()
else()
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Qt4 FOUND_VAR Qt4_FOUND
REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS}
VERSION_VAR QTVERSION
)
endif()
我知道我有qt 4我通过简单地解决了这个问题:
sudo yum install qt-devel