I referred this link. And I have the same problem.
PCLVisualizer addPointCloud crashes
I am using Qt C++.
I am using PCL1.8 (C:\Program Files\PCL1.8.0) I am using Windows 7 OS. All lib dependencies are given for PCL and VTK The application is not compiling. There is a link Error. MSVC compiler 64 bit. Following is my code snippet.
void MainWindow::on_pushButton_5_clicked()
{
pcl::PointCloud::Ptr cloud (new pcl::PointCloud) ;
int size=45;
cloud->resize(45);
for(int ix=0;ix!=45;ix++)
{
cloud->points[ix].x=ix;
cloud->points[ix].y=ix;
cloud->points[ix].z=ix;
cloud->points[ix].intensity=1;
}
boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer (new pcl::visualization::PCLVisualizer ("3D Viewer"));
viewer->setBackgroundColor (0.5, 0.5, 0.5);
viewer->addPointCloud<pcl::PointXYZI> (cloud, "sample cloud");
viewer->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "sample cloud");
viewer->addCoordinateSystem (1.0);
while (!viewer->wasStopped ())
{
viewer->spinOnce (100);
boost::this_thread::sleep (boost::posix_time::microseconds
(100000));
}
}
The error is attached below Link Error image
According to MSDN here and here you need to link User32.lib and Gdi32.lib
in .pro file:
LIBS += -lUser32 -lGdi32
Full solution might be found here.