在编译PUTN项目时出现如下报错
CMake Error at putn/src/putn/putn_rviz_plugins/CMakeLists.txt:46 (find_package):
Could not find a configuration file for package "Qt5" that exactly matches
requested version "5.9.5".
The following configuration files were considered but not accepted:
/usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake, version: 5.11.3
/home/test/Qt5.12.5/5.12.5/gcc_64/lib/cmake/Qt5/Qt5Config.cmake, version: 5.12.5
-- Configuring incomplete, errors occurred!
See also "/home/test/putn_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/test/putn_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed
原因是找不到5.9.5版本的Qt。
解决办法:打开putn/src/putn/putn_rviz_plugins/CMakeLists.txt文件,找到这段
“find_package(Qt5 ${rviz_QT_VERSION} EXACT REQUIRED Core Widgets )
## make target_link_libraries(${QT_LIBRARIES}) pull in all required dependencies
set(QT_LIBRARIES Qt5::Widgets)
endif()”删除其中的${rviz_QT_VERSION}将其改成
find_package(Qt5 EXACT REQUIRED Core Widgets )
## make target_link_libraries(${QT_LIBRARIES}) pull in all required dependencies
set(QT_LIBRARIES Qt5::Widgets)
endif()
保存重新编译