PointCloudLibrary / pcl

Point Cloud Library (PCL)

Home Page:https://pointclouds.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[compile error] "PointXYZINormal not supported by visualization"

dzenanz opened this issue · comments

Linking error given below.

Describe the error

Build started at 10:20...
1>------ Build started: Project: interactive_icp, Configuration: Debug x64 ------
1>interactive_icp.cpp
1>interactive_icp.obj : error LNK2019: unresolved external symbol "public: __cdecl pcl::visualization::PointCloudGeometryHandlerXYZ<struct pcl::PointXYZINormal>::PointCloudGeometryHandlerXYZ<struct pcl::PointXYZINormal>(class std::shared_ptr<class pcl::PointCloud<struct pcl::PointXYZINormal> const > const &)" (??0?$PointCloudGeometryHandlerXYZ@UPointXYZINormal@pcl@@@visualization@pcl@@QEAA@AEBV?$shared_ptr@$$CBV?$PointCloud@UPointXYZINormal@pcl@@@pcl@@@std@@@Z) referenced in function "public: bool __cdecl pcl::visualization::PCLVisualizer::addPointCloud<struct pcl::PointXYZINormal>(class std::shared_ptr<class pcl::PointCloud<struct pcl::PointXYZINormal> const > const &,class pcl::visualization::PointCloudColorHandler<struct pcl::PointXYZINormal> const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)" (??$addPointCloud@UPointXYZINormal@pcl@@@PCLVisualizer@visualization@pcl@@QEAA_NAEBV?$shared_ptr@$$CBV?$PointCloud@UPointXYZINormal@pcl@@@pcl@@@std@@AEBV?$PointCloudColorHandler@UPointXYZINormal@pcl@@@12@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@H@Z)
1>M:\Dev\PCL_tutorial\build2\Debug\interactive_icp.exe : fatal error LNK1120: 1 unresolved externals
1>Done building project "interactive_icp.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
========== Build completed at 10:20 and took 13.908 seconds ==========

To Reproduce

In

replace typedef pcl::PointXYZ PointT; by typedef pcl::PointXYZINormal PointT;.

Your Environment (please complete the following information):

  • OS:Windows 11
  • Compiler: Visual Studio 2022
  • PCL Version master.
  • PCL Type: Compiled from source, but dependencies were installed using vcpkg. I ran into a compile error when trying to install pcl using vcpkg

If PCL was compiled from source or failure in compiling PCL itself:

  • GPU, CUDA disabled

Possible Solution

Workaround: cast the cloud to PointXYZ before rendering.

Additional context

I am new to pcl, so I don't even know whether this is supposed to work.

The handler is instantiated here:

// Instantiations of specific point types
#ifdef PCL_ONLY_CORE_POINT_TYPES
PCL_INSTANTIATE(PointCloudGeometryHandlerXYZ, (pcl::PointSurfel)(pcl::PointXYZ)(pcl::PointXYZL)(pcl::PointXYZI)(pcl::PointXYZRGB)(pcl::PointXYZRGBA)(pcl::PointNormal)(pcl::PointXYZRGBNormal)(pcl::PointXYZRGBL)(pcl::PointWithRange))
PCL_INSTANTIATE(PointCloudGeometryHandlerSurfaceNormal, (pcl::Normal)(pcl::PointNormal)(pcl::PointXYZRGBNormal))
#else
PCL_INSTANTIATE(PointCloudGeometryHandlerXYZ, PCL_XYZ_POINT_TYPES)
PCL_INSTANTIATE(PointCloudGeometryHandlerSurfaceNormal, PCL_NORMAL_POINT_TYPES)
#endif

On Windows, PCL is always built with PCL_ONLY_CORE_POINT_TYPES defined, otherwise the binaries would get too large and the pcl_features library would completely fail to build (too many symbols for the Windows linker to handle).
So the handler is not instantiated for PointXYZINormal. But you can add #define PCL_NO_PRECOMPILE at the top of the .cpp file, to make the handler implementation available to the compiler (further information here: https://pcl.readthedocs.io/projects/tutorials/en/master/adding_custom_ptype.html#adding-custom-ptype )