Reputation: 1123
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
Upvotes: 7
Views: 7663
Reputation: 558
I explained here how to install PCL 1.8.1 all in one installer in windows. And what was the problem just make sure that:
Upvotes: 0
Reputation: 55
I also had the same problem and I solved by manually linking pcl_visualization.lib file. One can try following steps in 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.
It worked for me.
Upvotes: 0
Reputation: 3531
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.
Be sure of have installed correctly your PCL and dependencies. Please take a look in the downloads section here In my case, I downloaded the "all in one" version.
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
And finally, run the basic projects in the PCL website here
Have a nice day
Upvotes: 0
Reputation: 1123
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
Upvotes: 4
Reputation: 78428
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.
Upvotes: 1