1

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.

  1. error in Release mode

error LNK2001: unresolved external symbol "public: void __cdecl vtkProp3D::SetUserMatrix(class vtkMatrix4x4 *)" (?SetUserMatrix@vtkProp3D@@QEAAXPEAVvtkMatrix4x4@@@Z)

  1. 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)

piyushj
  • 1,546
  • 5
  • 21
  • 29
KHV
  • 145
  • 2
  • 4
  • 19
  • Possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Danh Nov 15 '16 at 07:16
  • The error is telling you that either your project or the PCL binary itself is not linking correctly to a required VTK library. So make sure your PCL visualisation .dll was built with VTK support, and make sure your project also links to VTK. – acraig5075 Nov 15 '16 at 07:17
  • Hi acraig5075, I have linked the PCL & VTK, LIB and DLL files successful, I am getting this error only when I try to intialize the PCLVisulaiser, when I comment it out there is no problem everthing is running fine, as u have suggested, I have also checked the Cmake File weather the VTK supporting were added or not, but everythinh was working fine. – KHV Nov 15 '16 at 13:15

0 Answers0