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
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 ?
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. Now it works. Lesson learned :D
It looks like you're not linking the PCL libraries. That could be because ${PCL_LIBRARIES}
is not set appropriately when running CMake. You could add
message("PCL_LIBRARIES - ${PCL_LIBRARIES}")
to your CMakeLists.txt file after the find_package
call to check the value.
If you're using CMake v2.8.8, this bug could be the cause of your problems. Try reverting to v2.8.7.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With