Some compilation errors occurred when using the pcl tool mesh_sampling

     Recently, I am using point cloud to solve the problem of 6 degrees of freedom pose estimation of three-dimensional objects. I need to convert the CAD file into a pcd format point cloud image. I saw that there is a related written routine in the pcl library https://github.com/ After copying PointCloudLibrary/pcl/blob/master/tools/mesh_sampling.cpp      , I pasted it directly into an empty project and directly used the configuration file I prepared before. Sure enough, there were still some problems. The problem was divided into two parts. After completing one, another one comes out, whether it is ros or VS at the time, this happens. Hey, this kind of thing is the most annoying, and time is wasted on it! Many people's solutions are not quite the same as mine. There are slight differences. I have a hunch that I may have similar problems in the future, so I will post them here and record them and share them.

 

 

1. After directly copying the code and compiling it, the prompts in the two pictures above appear. Check what everyone said. Generally speaking, it is because VS does not set some vtk configurations by default like cmake, so you need to configure it manually. See  https ://stackoverflow.com/questions/18642155/no-override-found-for-vtkpolydatamapper/41969027The   statement here is to paste it in front of the source file before any header files about vtk

#include "vtkAutoInit.h" 
VTK_MODULE_INIT(vtkRenderingOpenGL2); // VTK was built with vtkRenderingOpenGL2
VTK_MODULE_INIT(vtkInteractionStyle);

Then compile again, so there is problem 2.

2. After compilation, the following problem occurred. After checking what everyone said, it was very complicated anyway. They said that the initialized vtk configuration was different from the previously set configuration, and the cmake file needed to be changed. 

 

During this period, I have been very strange. I saw that the lib files in my vtk directory only have lib files such as vtkRenderingOpenGL, and there are no lib files of the vtkRenderingOpenGL2 series. I wonder if the first step should be changed to

#include "vtkAutoInit.h" 
VTK_MODULE_INIT(vtkRenderingOpenGL); // 把2去掉
VTK_MODULE_INIT(vtkInteractionStyle);

But after compilation, there are 100+ errors. I saw   https://stackoverflow.com/questions/40086584/errorno-override-found-for-vtkpolydatamapper/43222907 before. 

 After trying it, it worked!

Summary: In fact, the website referenced in the first step also mentions asking you to check whether you have installed vtkRenderingOpenGL2 or vtkRenderingOpenGL, but it does not mention what to do in the case of vtkRenderingOpenGL. If someone encounters this situation again, check it out first. It depends on which one you pretend to be.

Guess you like

Origin blog.csdn.net/u012057432/article/details/88420638