0

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

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

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

  • 将“vcpkg-master\installed\x64-windows-static\include”路径添加到属性页->VC++ 目录->包含目录
  • 将“vcpkg-master\installed\x64-windows-static\include”路径添加到属性页
    ->C/C++ ->Additional Include Directories
  • 将所有 lib 文件(在 vcpkg-master\installed\x64-windows-static\lib 中的那些)添加到属性页->链接器->附加依赖项
  • 在属性页->链接器->常规->附加库目录中添加了“vcpkg-master\installed\x64-windows-static\lib”路径

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

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

请注意,在安装的 PCL 目录中,有两个名为manual-link的文件夹。
第一个是“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 时遇到过同样的问题吗?这个问题有什么解决办法吗?

4

1 回答 1

0

三元组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

于 2018-03-14T19:15:09.657 回答