CMake qt+pcl+vs 项目常见问题

  1. Unknown Cmake command "QT4_WRAP_CPP"
    在这里插入图片描述
    这是因为你的CmakeLists.txt文件中qt的版本不正确。
    解决方法:
    在CmakeLists.txt 文件中所有Qt4改成你自己的版本,比如Qt5等。
  2. By not providing “FindQt5.cmake” in CMAKE_MODULE_PATH this project has
    asked CMake to find a package configuration file provided by “Qt5”, but
    CMake did not find one.
    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.

解决方法:进入CmakeLists.txt 文件,在project (pcl-visualizer)
添加上set(Qt5_DIR "E:\Qt5.9.1\5.9.1\msvc2017_64\lib\cmake\Qt5"),中间的路径要修改成自己的qt所存放的位置,但是后面\5.9.1\msvc2017_64\lib\cmake\Qt5是固定的。

  1. Found package configuration file:
    E:/Qt5.9.1/5.9.1/msvc2017_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

解决方法:
set(Qt5_DIR "E:\Qt5.9.1\5.9.1\msvc2017_64\lib\cmake\Qt5")之后添加下面三行

find_package (Qt5Widgets)
find_package (Qt5Core)
find_package (Qt5Gui)

并把find_package (Qt5 REQUIRED)这行代码删掉

4.CMake Error at CMakeLists.txt:27 (include): include called with wrong number of arguments. include() only takes one file.
解决方法:
INCLUDE (${QT_USE_FILE})
修改成为INCLUDE _DIRECTORIES (${QT_USE_FILE})即可。

  • 5
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
搭建点云开发环境需要安装以下软件: 1. Visual Studio 2017:用于编写C++代码。 2. Qt 5.10.1:用于构建GUI界面。 3. PCL 1.8.1:点云库。 4. VTK 8.0:用于可视化点云数据。 以下是具体的步骤: 1. 安装 Visual Studio 2017,选择 C++ 工作负载。此外,还需要安装 CMake。 2. 下载 Qt 5.10.1 安装包并安装。需要安装的组件有:Qt 5.10.1 MSVC2017 64-bit、Qt Visual Studio Tools、Qt Charts 和 Qt Data Visualization。 3. 下载 PCL 1.8.1 for Windows,并解压到一个目录下。 4. 下载 VTK 8.0 for Windows,并解压到一个目录下。 5. 打开 CMake,设置源代码路径为 PCL 的根目录,设置构建路径为一个新的目录(例如:PCL_build)。点击 Configure,选择 Visual Studio 15 2017 Win64 作为生成器,点击 Finish。 6. 在 CMake 中,找到 VTK_DIR 设置项,将其设置为 VTK 的安装目录(例如:D:/VTK-8.0.0/build)。点击 Configure,然后点击 Generate。 7. 打开 Visual Studio 2017,选择 File > New > Project,选择 Qt Widgets Application。设置项目名称、位置和解决方案名称,然后点击 Create。 8. 在项目属性中,选择 C/C++ > General,将 Additional Include Directories 设置为 PCL 的 include 目录(例如:D:/PCL-1.8.1/include/pcl-1.8)和 VTK 的 include 目录(例如:D:/VTK-8.0.0/include/vtk-8.0)。 9. 在项目属性中,选择 Linker > General,将 Additional Library Directories 设置为 PCL 的 lib 目录(例如:D:/PCL-1.8.1/lib)和 VTK 的 lib 目录(例如:D:/VTK-8.0.0/build/bin/Release)。 10. 在项目属性中,选择 Linker > Input,将 Additional Dependencies 设置为以下库:pcl_common_release.lib、pcl_io_ply_release.lib、pcl_visualization_release.lib、vtkCommonCore-8.0.lib、vtkFiltersCore-8.0.lib、vtkInteractionStyle-8.0.lib、vtkRenderingCore-8.0.lib。 11. 编写代码并构建项目,即可开始点云开发。 以上是在 Windows 10、Visual Studio 2017、Qt 5.10.1、PCL 1.8.1 和 VTK 8.0 环境下的点云开发环境搭建步骤。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值