The savePCDFileASCII()
function is expecting a const reference to PointCloud
while you supply a pointer. You have to dereference the pointer:
pcl::io::savePCDFileASCII ("test_pcd_here.pcd", *cloud);
Keep in mind that your callback function is triggered as often as possible (more than once a second) so you may want to throttle the export. And more importantly, if you try to write the data while the other program is reading it (or the other way around), either program may crash (race condition) so you'll need some form of synchronization or stream the PointCloud directly through other means (socket or pipe for example).