I'm currently programming a Qt GUI to remote control a ROS-controlled robot. When using catkin_make
in the catkin_ws I got the following error:
CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by "Qt5" with any of
the following names:
Qt5Config.cmake
qt5-config.cmake
Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
to a directory containing one of the above files. If "Qt5" provides a
separate development package or SDK, be sure it has been installed.
Call Stack (most recent call first):
gui/CMakeLists.txt:31 (find_package)
I then tried to solve the error by putting set(Qt5_DIR /home/user/Qt/5.12.0/gcc_64/lib/cmake/Qt5)
(which contains the Qt5Config.cmake) in the gui/CMakeLists.txt and got a new error:
CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Found package configuration file:
/home/user/Qt/5.12.0/gcc_64/lib/cmake/Qt5/Qt5Config.cmake
but it set Qt5_FOUND to FALSE so package "Qt5" is considered to be NOT
FOUND. Reason given by package:
The Qt5 package requires at least one component
Call Stack (most recent call first):
gui/CMakeLists.txt:33 (find_package)
Another Qt5Config.cmake is in /usr/lib/x86_64-linux-gnu/cmake/Qt5
though putting set(Qt5_DIR /usr/lib/x86_64-linux-gnu/cmake/Qt5)
into the gui/CMakeLists.txt only leads to a similar error (just with a different path).
I'm kind of lost right now, maybe someone can point me to the right direction?
If it helps, I'm on Ubuntu 16.04.
Find Package Does More than just setting a path.
You can Add Path to the Qt folder in CMAKE_PREFIX_PATH
to avoid it like this:
export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:/home/user/Qt/5.12.0/gcc_64
or you can install qt binaries for ROS using apt-get Like This:
sudo apt-get install ros-kinetic-libqt-*
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.