Problems linking pcl::io in ROS indigo
Hello all;
I have been working for a while with ROS Indigo and its included version of PCL. I am on a Ubuntu 14.04 x64 desktop. Previous nodes all work ok, but in the one I am programming now, I need to include pcl::io. the code reduced to minimal is:
#include "ros/ros.h"
#include <ros/package.h>
#include <sensor_msgs/PointCloud2.h>
//PCL
#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl_conversions/pcl_conversions.h>
int main(int argc, char **argv)
{
ros::init(argc, argv, "halcon3D_test_node");
ros::NodeHandle n;
//test PointCloud_to_ObjectModel3D
ros::Publisher pub = n.advertise<sensor_msgs::PointCloud2>("point_cloud", 1000);
std::string path = ros::package::getPath("tekniker_halcon_drivers") + "/resources/";
std::string fileName = path + "CSite1_orig-utm.pcd";
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
//pcl::io::loadPCDFile<pcl::PointXYZ> ("/home/alberto/catkin_euroc_ch1/src/tekniker_euroc_c1/resources/STL/object.pcd", *cloud);
ros::Rate loop_rate(10);
while (ros::ok())
{
sensor_msgs::PointCloud2 cloud2;
pcl::toROSMsg(*cloud, cloud2);
cloud2.header.frame_id = "point_cloud_link";
cloud2.header.stamp = ros::Time::now();
pub.publish(cloud2);
ros::spinOnce();
loop_rate.sleep();
}
return 0;
}
However, if I uncomment ths line:
pcl::io::loadPCDFile<pcl::PointXYZ> ("/home/alberto/catkin_euroc_ch1/src/tekniker_euroc_c1/resources/STL/object.pcd", *cloud);
I obtain the following linking errors:
//usr/lib/libpq.so.5: undefined reference to `SSL_get_peer_certificate@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `CRYPTO_num_locks@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_CTX_use_certificate_chain_file@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_use_certificate_file@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `ENGINE_free@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `OPENSSL_config@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_get_error@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_use_PrivateKey_file@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `X509_STORE_load_locations@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_set_ex_data@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_read@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `X509_STORE_set_flags@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSLv23_method@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `ENGINE_load_private_key@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `X509_get_subject_name@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `CRYPTO_set_id_callback@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_CTX_new@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_CTX_get_cert_store@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_check_private_key@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `ENGINE_by_id@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `ERR_get_error@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `CRYPTO_set_locking_callback@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_load_error_strings@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_new@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference ...
Please show us how you are building all of this. Without your
CMakeLists.txt
, we cannot know whether the issue might just be a missing statement or something more involved. Also: please remove all the boilerplate comments from yourCMakeLists.txt
before copy/pasting it in your question.