问题
Presently I am using Visual Studio 2010, PCL 1.8.0/1.6.0, Now as per my requirement I have to add and bounding box to the cloud and to visualize the bounding box weather it is created for the given cloud, for Visualising we require the PCLVisualizer, when I am trying to initialize the PCLVisualizer get the below linker error and, As I am using the latest version of PCL, I though there might be any bug and I have downgraded to the older version 1.6.0 and tried but facing the same error can any one suggest me where I am exactly going wrong
Here is the code that I am using.
int BoundingBox(pcl::PointCloud<pcl::PointXYZ>::Ptr point_cloud_ptr)
{
// compute principal direction
Eigen::Vector4f centroid;
pcl::compute3DCentroid(*point_cloud_ptr, centroid);
Eigen::Matrix3f covariance;
computeCovarianceMatrixNormalized(*point_cloud_ptr, centroid, covariance);
Eigen::SelfAdjointEigenSolver<Eigen::Matrix3f> eigen_solver(covariance, Eigen::ComputeEigenvectors);
Eigen::Matrix3f eigDx = eigen_solver.eigenvectors();
eigDx.col(2) = eigDx.col(0).cross(eigDx.col(1));
// move the points to the that reference frame
Eigen::Matrix4f p2w(Eigen::Matrix4f::Identity());
p2w.block<3,3>(0,0) = eigDx.transpose();
p2w.block<3,1>(0,3) = -1.f * (p2w.block<3,3>(0,0) * centroid.head<3>());
pcl::PointCloud<pcl::PointXYZ> cPoints;
pcl::transformPointCloud(*point_cloud_ptr, cPoints, p2w);
pcl::PointXYZ min_pt, max_pt;
pcl::getMinMax3D(cPoints, min_pt, max_pt);
const Eigen::Vector3f mean_diag = 0.5f*(max_pt.getVector3fMap() + min_pt.getVector3fMap());
// final transform
const Eigen::Quaternionf qfinal(eigDx);
const Eigen::Vector3f tfinal = eigDx*mean_diag + centroid.head<3>();
// draw the cloud and the box
pcl::visualization::PCLVisualizer viewer;
viewer.addPointCloud(point_cloud_ptr);
viewer.addCube(tfinal, qfinal, max_pt.x - min_pt.x, max_pt.y - min_pt.y, max_pt.z - min_pt.z);
viewer.spin();
return(0);
}
the error which i get is shown below.
- error in Release mode
error LNK2001: unresolved external symbol "public: void __cdecl vtkProp3D::SetUserMatrix(class vtkMatrix4x4 *)" (?SetUserMatrix@vtkProp3D@@QEAAXPEAVvtkMatrix4x4@@@Z)
- error in Debug mode
error LNK2019: unresolved external symbol "public: void __cdecl vtkProp3D::SetUserMatrix(class vtkMatrix4x4 *)" (?SetUserMatrix@vtkProp3D@@QEAAXPEAVvtkMatrix4x4@@@Z) referenced in function "private: bool __cdecl pcl::visualization::PCLVisualizer::fromHandlersToScreen(class pcl::visualization::PointCloudGeometryHandler const &,class pcl::visualization::PointCloudColorHandler const &,class std::basic_string,class std::allocator > const &,int,class Eigen::Matrix const &,class Eigen::Quaternion const &)" (??$fromHandlersToScreen@UPointXYZ@pcl@@@PCLVisualizer@visualization@pcl@@AEAA_NAEBV?$PointCloudGeometryHandler@UPointXYZ@pcl@@@12@AEBV?$PointCloudColorHandler@UPointXYZ@pcl@@@12@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HAEBV?$Matrix@M$03$00$0A@$03$00@Eigen@@AEBV?$Quaternion@M$0A@@8@@Z)
来源:https://stackoverflow.com/questions/40603535/linker-error-lnk-2019-lnk1120-using-pcl-1-8-0-1-6-0