安装点云库

Install Point Cloud Library

本文关键字:安装      更新时间:2023-10-16

我最近被介绍给vcpkg,因为我一直在寻找安装点云库(PCL)的最佳方法,以便在我的Visual Studio C++项目中使用它。

我已经使用.vcpkg install pcl:x64-windows-static安装了PLC静态库,然后.vcpkg integrate install将库和dll集成到Visual Studio 2017中。我现在的目标是在 PCL 官方网站上运行迭代最近点算法的演示。

我创建了一个原始项目,并执行以下操作来添加PCL:

  • 添加了"vcpkg-master\installed\x64-windows-static\include"路径到属性页->VC++目录->包含目录
  • 将"vcpkg-master\installed\x64-windows-static\include"路径添加到属性页
    ->C/C++ ->其他包含目录
  • 添加了所有库文件(vcpkg-master\installed\x64-windows-static\lib 中的文件)到属性页>链接器->其他依赖项
  • 添加了"vcpkg-master\installed\x64-windows-static\lib"路径到属性页>链接器->常规->其他库目录

我正在尝试在调试x86模式下编译前面提到的演示,但不断收到以下错误:

1>LINK : fatal error LNK1104: cannot open file 'manual-link.obj'

请注意,在已安装的 PCL 目录中,有两个文件夹称为手动链接
第一个是"vcpkg-master\installed\x64-windows-static\debug\lib\manual-link",包含两个lib文件:

  • boost_prg_exec_monitor-VC140-MT-GD.lib
  • boost_test_exec_monitor-VC140-MT-GD.lib

另一个是"vcpkg-master\installed\x64-windows-static\lib\manual-link",包括:

  • boost_prg_exec_monitor-VC140-MT.lib
  • boost_test_exec_monitor-VC140-MT.lib

我不知道我在这里错过了什么。有没有人在PCL和Visual Studio 2017上遇到过同样的问题?这个问题有什么解决方案吗?

x64-windows-static

个三元组不会被自动选中[1] - 您需要编辑MSBuild vcxproj并将VcpkgTripletMSBuild属性设置为x64-windows-static

<PropertyGroup Label="Globals">
<!-- .... -->
<VcpkgTriplet Condition="'$(Platform)'=='Win32'">x86-windows-static</VcpkgTriplet>
<VcpkgTriplet Condition="'$(Platform)'=='x64'">x64-windows-static</VcpkgTriplet>
</PropertyGroup>

请注意,如果执行此操作,还需要将 CRT (/MT) 更改为静态链接。

或者,您可以安装动态库 (x64-windows),默认情况下它们将自动拾取并使用新项目的设置,而无需进行任何更改。

无论哪种方式,都不需要向其他包含目录或附加依赖项添加任何路径。

[1] https://github.com/Microsoft/vcpkg/blob/master/docs/users/integration.md#triplet-selection