2014-05-13 37 views
0

我是pcl庫的新手,我在連接示例項目時遇到問題。從PCL庫開始

我已經下載了所有功能於一身的安裝程序vsmc2010 64 (該OpenNI庫不安裝成功,並重復這不安裝)

在Visual Studio 2010中的項目:

  1. 我已創建一個新的Win32控制檯項目
  2. 用於特性:
    • C++ - >常規 - >包括升壓,特徵和PCL include目錄
    • 連接器 - >常規 - >附加libraries-> PCL lib文件夾

#include <iostream> 
#include <pcl/point_types.h> 
#include <pcl/filters/passthrough.h> 

int main (int argc, char** argv) 
{ 
    pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>); 
    pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_filtered (new pcl::PointCloud<pcl::PointXYZ>); 

    // Fill in the cloud data 
    cloud->width = 5; 
    cloud->height = 1; 
    cloud->points.resize (cloud->width * cloud->height); 

    for (size_t i = 0; i < cloud->points.size(); ++i) 
    { 
    cloud->points[i].x = 1024 * rand()/(RAND_MAX + 1.0f); 
    cloud->points[i].y = 1024 * rand()/(RAND_MAX + 1.0f); 
    cloud->points[i].z = 1024 * rand()/(RAND_MAX + 1.0f); 
    } 

    std::cerr << "Cloud before filtering: " << std::endl; 
    for (size_t i = 0; i < cloud->points.size(); ++i) 
    std::cerr << " " << cloud->points[i].x << " " 
         << cloud->points[i].y << " " 
         << cloud->points[i].z << std::endl; 

    // Create the filtering object 
    pcl::PassThrough<pcl::PointXYZ> pass; 
    /*pass.setInputCloud (cloud); 
    pass.setFilterFieldName ("z"); 
    pass.setFilterLimits (0.0, 1.0); 
    //pass.setFilterLimitsNegative (true); 
    pass.filter (*cloud_filtered); 

    std::cerr << "Cloud after filtering: " << std::endl; 
    for (size_t i = 0; i < cloud_filtered->points.size(); ++i) 
    std::cerr << " " << cloud_filtered->points[i].x << " " 
         << cloud_filtered->points[i].y << " " 
         << cloud_filtered->points[i].z << std::endl;*/ 

    return (0); 
} 

但我有鏈接錯誤:

Error 8 error LNK2019: símbolo externo "protected: void __cdecl pcl::PassThrough<struct pcl::PointXYZ>::applyFilterIndices(class std::vector<int,class std::allocator<int> > &)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected][email protected]@[email protected]@@[email protected]@@Z) sin resolver al que se hace referencia en la función "protected: virtual void __cdecl pcl::PassThrough<struct pcl::PointXYZ>::applyFilter(class std::vector<int,class std::allocator<int> > &)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected][email protected]@[email protected]@@[email protected]@@Z) 

任何人能幫助我嗎?

+0

這是一個模板方法,它們沒有外部鏈接。在我看來,像「pcl」庫程序員摸索了這一點。不知道什麼樣的庫可能是,它當然不是「打印機控制語言」。我想,請使用Point Cloud Library郵件列表。 –

+0

如果你剛開始,考慮使用CMake。它會更容易,因爲它將包括所有的東西。如果您以前從未使用過CMake,請不要猶豫提出進一步的問題。 UPD:但是關於你的錯誤,好像VS沒有在.lib文件中看到實現,或根本找不到lib文件。 –

回答

0

我建議您使用CMake來創建您的PCL項目。 下面我將使用一體化安裝程序將指南鏈接到最新的PCL 1.8.0發行版,請注意,它可以與Visual Studio 2013或2015一起使用。請務必使用本網站提供的CMakeLists.txt如果您選擇遵循本指南,我最初使用另一個給了我一些鏈接器問題。

的CMake:https://cmake.org/ PCL 1.8.0:http://unanancyowen.com/en/pcl18/

希望這有助於!