PointCloudLibrary / pcl

Point Cloud Library (PCL)
https://pointclouds.org/
Other
9.89k stars 4.61k forks source link

[compile error] "PointXYZINormal not supported by visualization" #5991

Closed dzenanz closed 6 months ago

dzenanz commented 6 months ago

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 https://github.com/PointCloudLibrary/pcl/blob/ad2bf688b2d036fe703cd16ea6d574e453e101b2/doc/tutorials/content/sources/interactive_icp/interactive_icp.cpp#L10 replace typedef pcl::PointXYZ PointT; by typedef pcl::PointXYZINormal PointT;.

Your Environment (please complete the following information):

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

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.

mvieth commented 6 months ago

The handler is instantiated here: https://github.com/PointCloudLibrary/pcl/blob/ad2bf688b2d036fe703cd16ea6d574e453e101b2/visualization/src/point_cloud_handlers.cpp#L788-L795

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 )