Error when using PCLVisualizer
I was trying to use PCLVisualizer in a node but when I try to compile (using rosmake) I get as error
/usr/bin/ld: CMakeFiles/viz.dir/src/cluster_visualizer.o: undefined reference to symbol 'vtkSmartPointerBase::operator=(vtkObjectBase*)'
/usr/bin/ld: note: 'vtkSmartPointerBase::operator=(vtkObjectBase*)' is defined in DSO /usr/lib/libvtkCommon.so.5.6 so try adding it to the linker command line
/usr/lib/libvtkCommon.so.5.6: could not read symbols: Invalid operation
Here's the CMakeLists.txt
I use
cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)rosbuild_init()
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/include/cluster_extraction )list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(Eigen REQUIRED)
include_directories(${Eigen_INCLUDE_DIRS})rosbuild_add_executable(viz src/cluster_visualizer.cpp)
and here's the source code:
#include <iostream>
#include <boost/thread/thread.hpp>
#include <pcl/common/common_headers.h>
#include <pcl/io/pcd_io.h>
#include <pcl/visualization/pcl_visualizer.h>
int main () {
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
pcl::io::loadPCDFile<pcl::PointXYZ> ("/tmp/pointCloud0.pcd", *cloud);
boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer (new pcl::visualization::PCLVisualizer ("3D Viewer"));
viewer->setBackgroundColor (0, 0, 0);
viewer->addPointCloud<pcl::PointXYZ> (cloud, "sample cloud");
viewer->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "sample cloud");
viewer->addCoordinateSystem (1.0);
viewer->initCameraParameters ();
viewer->spin();
}
Any suggestion on how can I fix? I'm using Ubuntu 11.10 with electric
EDIT:
my manifest.xml is
<package>
<description brief="cluster_extraction">
cluster_extraction
</description>
<author>Manlio</author>
<license>BSD</license>
<review status="unreviewed" notes=""/>
<url>http://ros.org/wiki/cluster_extraction</url>
<depend package="roscpp"/>
<depend package="std_msgs"/>
<depend package="sensor_msgs"/>
<depend package="pcl"/>
<depend package="pcl_ros"/>
<depend package="common_rosdeps" />
<rosdep name="eigen" />
</package>
What do you have in your manifest.xml?
@EricPerko I edited the question adding the manifest