我想在我的代碼中的兩個源文件中使用pcl::io::savePNGFile
。在多個文件中包含<pcl/io/png_io.h>時發生鏈接錯誤
只要我有需要的包括第二源文件
# include <pcl/io/png_io.h>
該項目不編譯。
的錯誤信息是:
/usr/include/pcl-1.7/pcl/io/png_io.h:86: multiple definition of `pcl::io::saveRgbPNGFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned char const*, int, int)'
我要去換行功能的一類,以包括只在項目一次。但我認爲這不是最好的方法。我是否以錯誤的方式做事?有更好的解決方案嗎?
謝謝!
EDIT
最後我實現的Q- & d溶液和包裹函數(僅在正常雲)
cloudsaver.h
#ifndef CLOUDSAVER_H
#define CLOUDSAVER_H
#include <pcl/point_types.h>
#include <pcl/point_cloud.h>
#include <string>
class CloudSaver
{
public:
CloudSaver();
void saveCloudToPNG(const std::string & fileName, const pcl::PointCloud<pcl::PointXYZRGBNormal>& cl);
};
#endif // CLOUDSAVER_H
cloudsaver.cpp
#include "cloudsaver.h"
# include <pcl/io/png_io.h>
CloudSaver::CloudSaver()
{
}
void CloudSaver::saveCloudToPNG(const std::string & fileName, const pcl::PointCloud<pcl::PointXYZRGBNormal>& cl)
{
pcl::io::savePNGFile<pcl::PointXYZRGBNormal>(fileName, cl);
}
但我仍然好奇,如何正確地做到這一點。
感謝您的信息!你知道嗎,如果這個函數被棄用,savePNG的替代品是什麼?我需要從定義的角度將雲視圖保存爲圖像。 –
我發現了一個新的SavePNG函數,在這裏討論:[https://github.com/PointCloudLibrary/pcl/pull/204],代碼也在這裏,https://github.com/PointCloudLibrary/pcl/commit/9493da243331dd32f928f9c0a2e37101fe25bb29感謝PCL開發人員。 –