【问题标题】:Point Cloud Library Build Errors in Visual StudioVisual Studio 中的点云库构建错误
【发布时间】:2015-01-28 11:19:41
【问题描述】:

我正在尝试将点云库与 kinect 一起用于论文,但是当我关注 this tutorial 并尝试在 Visual Studio 2010 中编译解决方案时,我遇到了一些构建错误:

pcd_write.obj : error LNK2019: unresolved external symbol "public: int __thiscall pcl::PCDWriter::writeASCII(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,struct sensor_msgs::PointCloud2 const &,class Eigen::Matrix<float,4,1,0,4,1> const &,class Eigen::Quaternion<float,0> const &,int)" (?writeASCII@PCDWriter@pcl@@QAEHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABUPointCloud2@sensor_msgs@@ABV?$Matrix@M$03$00$0A@$03$00@Eigen@@ABV?$Quaternion@M$0A@@8@H@Z) referenced in function "public: virtual int __thiscall pcl::PCDWriter::write(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,struct sensor_msgs::PointCloud2 const &,class Eigen::Matrix<float,4,1,0,4,1> const &,class Eigen::Quaternion<float,0> const &,bool)" (?write@PCDWriter@pcl@@UAEHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABUPointCloud2@sensor_msgs@@ABV?$Matrix@M$03$00$0A@$03$00@Eigen@@ABV?$Quaternion@M$0A@@8@_N@Z)
pcd_write.obj : error LNK2019: unresolved external symbol "public: int __thiscall pcl::PCDWriter::writeBinary(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,struct sensor_msgs::PointCloud2 const &,class Eigen::Matrix<float,4,1,0,4,1> const &,class Eigen::Quaternion<float,0> const &)" (?writeBinary@PCDWriter@pcl@@QAEHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABUPointCloud2@sensor_msgs@@ABV?$Matrix@M$03$00$0A@$03$00@Eigen@@ABV?$Quaternion@M$0A@@8@@Z) referenced in function "public: virtual int __thiscall pcl::PCDWriter::write(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,struct sensor_msgs::PointCloud2 const &,class Eigen::Matrix<float,4,1,0,4,1> const &,class Eigen::Quaternion<float,0> const &,bool)" (?write@PCDWriter@pcl@@UAEHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABUPointCloud2@sensor_msgs@@ABV?$Matrix@M$03$00$0A@$03$00@Eigen@@ABV?$Quaternion@M$0A@@8@_N@Z)
pcd_write.obj : error LNK2019: unresolved external symbol "void __cdecl pcl::console::print(enum pcl::console::VERBOSITY_LEVEL,char const *,...)" (?print@console@pcl@@YAXW4VERBOSITY_LEVEL@12@PBDZZ) referenced in function "public: int __thiscall pcl::PCDWriter::writeASCII<struct pcl::PointXYZ>(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class pcl::PointCloud<struct pcl::PointXYZ> const &,int)" (??$writeASCII@UPointXYZ@pcl@@@PCDWriter@pcl@@QAEHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$PointCloud@UPointXYZ@pcl@@@1@H@Z)

谁能解释为什么会出现这些错误以及如何解决它们?非常感谢所有帮助,我总是接受答案!

【问题讨论】:

  • 这些是链接器错误 - 看起来所需的 PCL 库没有被链接。如果将message("PCL_IO_LIBRARIES - ${PCL_IO_LIBRARIES}") 添加到 CMakeLists.txt 的脚下并重新运行 cmake,您将看到哪些值被设置为依赖项。

标签: visual-studio-2010 point-cloud-library


【解决方案1】:

您可能使用了错误的 PCL 版本(64 位/32 位)。如果您正在生成 64 位 CMake 项目,请务必为 Visual Studio 2010 安装 64 位 PCL 库。如果您不确定正在使用的 PCL 版本,可以按照 Fraser 的建议进行检查。

您可以从here 下载正确的 PCL 库。

【讨论】:

  • 现在我收到错误:Unable to start program .../ALL_BUILD. The system cannot find the file specified
  • 项目编译是否没有任何错误?如果是这种情况,请在 Visual Studio 的“项目资源管理器”中右键单击生成可执行文件的项目名称,然后选择“设置为活动”(项目资源管理器面板应该在左侧,并且还应该包含 ALL_BUILD 和 ZERO_CHECK 项目)。调试或执行项目时,它应该询问您可执行文件的位置:在包含项目文件的文件夹中查找它,通常在 Debug 或 Release 子文件夹中(取决于构建配置)。
  • 我现在收到另一个错误,提示找不到 DLL。这是通过将该 DLL 从其目录复制并粘贴到我的项目来解决的。我可能也可以通过将该 DLL 添加到 PATH 来解决它,但除非我有另一个项目,否则这不是必需的。我已将您的答案标记为对我有很大帮助,但我仍然不明白为什么 ALL_BUILD 不起作用。它没有目的吗?
  • 感谢您接受我的回答! Probably, when ALL_BUILD was selected, Visual Studio prompted for an "Executable for Debug Session" but the wrong executable name was provided or it was not provided at all (at least that's how I can recreate your issue on my system).您可以查看this page,了解 CMake 生成的其他辅助项目的详细说明!
【解决方案2】:

我遇到了同样的错误,我找到了解决方案。使用 cmake 时,如果使用 64 位 PCL 库,请确保选择 Visual Studio 10 win64 生成器。我最初使用 Visual Studio 10 生成器并得到完全相同的错误。当我将它切换到 Visual Studio 10 win64 生成器时,它就像一个魅力。

【讨论】:

  • 请发表评论。
  • 为什么这是评论而不是答案?
  • 谢谢,这对我很有帮助,解决了我的问题!
  • 很高兴我能帮上忙!
猜你喜欢
  • 2022-01-24
  • 1970-01-01
  • 2018-12-03
  • 2019-03-07
  • 2021-04-16
  • 1970-01-01
  • 2018-08-21
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多