简体   繁体   English

点云库简单示例链接错误

[英]Point Cloud Library Simple Example Link Error

I am trying to run the following PCL simple viewer example from http://pointclouds.org/documentation/tutorials/pcl_visualizer.php I have successfully built the binary tree using Cmake and the recommended Cmakelists.txt 我试图从http://pointclouds.org/documentation/tutorials/pcl_visualizer.php运行以下PCL简单查看器示例我已使用Cmake和推荐的Cmakelists.txt成功构建了二叉树。

After generation, when I try to build it I get the following error : 生成后,当我尝试构建它时,我收到以下错误:

error LNK2019: unresolved external symbol "public: void __thiscall pcl::visualization::PCLVisualizer::initCameraParameters(void)" (?initCameraParameters@PCLVisualizer@visualization@pcl@@QAEXXZ) referenced in function "class boost::shared_ptr<class pcl::visualization::PCLVisualizer> __cdecl simpleVis(class boost::shared_ptr<class pcl::PointCloud<struct pcl::PointXYZ> const >)" (?simpleVis@@YA?AV?$shared_ptr@VPCLVisualizer@visualization@pcl@@@boost@@V?$shared_ptr@$$CBV?$PointCloud@UPointXYZ@pcl@@@pcl@@@2@@Z)`

error LNK2019: unresolved external symbol "public: void __thiscall pcl::visualization::PCLVisualizer::addCoordinateSystem(double,int)" (?addCoordinateSystem@PCLVisualizer@visualization@pcl@@QAEXNH@Z) referenced in function "class boost::shared_ptr<class pcl::visualization::PCLVisualizer> __cdecl simpleVis(class boost::shared_ptr<class pcl::PointCloud<struct pcl::PointXYZ> const >)" (?simpleVis@@YA?AV?$shared_ptr@VPCLVisualizer@visualization@pcl@@@boost@@V?$shared_ptr@$$CBV?$PointCloud@UPointXYZ@pcl@@@pcl@@@2@@Z)


error LNK2019: unresolved external symbol "public: bool __thiscall pcl::visualization::PCLVisualizer::setPointCloudRenderingProperties(int,double,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)" (?setPointCloudRenderingProperties@PCLVisualizer@visualization@pcl@@QAE_NHNABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z) referenced in function "class boost::shared_ptr<class pcl::visualization::PCLVisualizer> __cdecl simpleVis(class boost::shared_ptr<class pcl::PointCloud<struct pcl::PointXYZ> const >)" (?simpleVis@@YA?AV?$shared_ptr@VPCLVisualizer@visualization@pcl@@@boost@@V?$shared_ptr@$$CBV?$PointCloud@UPointXYZ@pcl@@@pcl@@@2@@Z)

And these are just a few... am I missing something in the cmakelists.txt ? 这些只是一些......我在cmakelists.txt中遗漏了什么?

cmake_minimum_required(VERSION 2.6 FATAL_ERROR)

project(pcl_visualizer_viewports)

find_package(PCL 1.5.1 REQUIRED)

include_directories(${PCL_INCLUDE_DIRS})

link_directories(${PCL_LIBRARY_DIRS})

add_definitions(${PCL_DEFINITIONS})

add_executable (pcl_visualizer_demo pcl_visualizer_demo.cpp)

target_link_libraries (pcl_visualizer_demo ${PCL_LIBRARIES})

Any help is appreciated. 任何帮助表示赞赏。 Thanks 谢谢

Found what the problem was : Although I am running a 64 bit machine, my compiler (VS2010) is configured for 32 bit so I needed to uninstall the 64 bit Point Cloud Library and install the 32 bit version. 发现问题所在:虽然我运行64位机器,但我的编译器(VS2010)配置为32位,所以我需要卸载64位Point Cloud Library并安装32位版本。 Now it works. 现在它有效。 Lesson learned :D 获得的经验教训:D

It looks like you're not linking the PCL libraries. 看起来你没有链接PCL库。 That could be because ${PCL_LIBRARIES} is not set appropriately when running CMake. 这可能是因为运行CMake时没有正确设置${PCL_LIBRARIES} You could add 你可以添加

message("PCL_LIBRARIES - ${PCL_LIBRARIES}")

to your CMakeLists.txt file after the find_package call to check the value. find_package调用之后到你的CMakeLists.txt文件来检查值。

If you're using CMake v2.8.8, this bug could be the cause of your problems. 如果您使用的是CMake v2.8.8,则此错误可能是导致问题的原因。 Try reverting to v2.8.7 . 尝试恢复到v2.8.7

I think is so complicated can find an error in that way. 我认为这么复杂可以通过这种方式找到错误。 I have installed PCL in my computer, Windows 7 64 bits and VStudio 2010, the samples run fine. 我已经在我的电脑,Windows 7 64位和VStudio 2010中安装了PCL,样品运行正常。

Be sure of have installed correctly your PCL and dependencies. 确保已正确安装了PCL和依赖项。 Please take a look in the downloads section here In my case, I downloaded the "all in one" version. 请看这里的下载部分在我的情况下,我下载了“all in one”版本。

Follow the instructions, step by step, is not very complicated. 按照说明,一步一步,并不是很复杂。

After you can see how is structured the "cmake file" here Try to download the latest version of cmake 之后你可以看到如何构成的“cmake的文件” 在这里尝试下载最新版本的CMake的

And finally, run the basic projects in the PCL website here 最后,在此处运行PCL网站中的基本项目

Have a nice day 祝你今天愉快

I also had the same problem and I solved by manually linking pcl_visualization.lib file. 我也有同样的问题,我通过手动链接pcl_visualization.lib文件解决了。 One can try following steps in visual c++ 2010: 可以尝试在visual c ++ 2010中执行以下步骤:

Project Properties -> Linker -> Input -> Additional Dependencies -> Add the file. 项目属性 - >链接器 - >输入 - >附加依赖项 - >添加文件。

In my case, I added G:\\PCL\\PCL 1.6.0\\lib\\pcl_visualization_release.lib for release and G:\\PCL\\PCL 1.6.0\\lib\\pcl_visualization_debug.lib for debug. 就我而言,我添加了G:\\ PCL \\ PCL 1.6.0 \\ lib \\ pcl_visualization_release.lib用于发布, G:\\ PCL \\ PCL 1.6.0 \\ lib \\ pcl_visualization_debug.lib用于调试。

It worked for me. 它对我有用。

I explained here how to install PCL 1.8.1 all in one installer in windows. 在这里解释如何在Windows中的一个安装程序中安装PCL 1.8.1。 And what was the problem just make sure that: 问题是什么才能确保:

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM