Qt4 will not compile with CMake

Now I'm on Linux with KDevelop for C ++, and I want to compile a Qt4 application, but when I do this, it causes the following error:

I am compiling with:

cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Debug /home/myname/projects/First Qt projet/ 

These are the errors:

 -- 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) 

What should I do?

+6
source share
2 answers
 sudo apt-get install libqt4-core libqt4-dev libqt4-gui qt4-dev-tools 

This should install qt4 for you at: / usr / lib64 / qt ... from there, cmake should be able to find the qt location for you.

You can also use this Ubuntu package manager if the command line is not your style.

+13
source

Not sure if this helps anyone, but for Fedora I had the following problem:

CMake error in / usr / share / cmake / Modules / FindQt 4.cmake: 1386 (message): Found the wrong version of Qt "" from NOTFOUND, this code requires Qt 4.x Call stack (last call first): bgrive / CMakeLists .txt: 3 (find_package)

After going through FindQt4.cmake, I found this:

 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() 

I know that my qt 4I solved this by simply doing:

 sudo yum install qt-devel 
+5
source

All Articles