2012-04-26 69 views
4

我試圖運行從http://pointclouds.org/documentation/tutorials/pcl_visualizer.php 以下PCL簡單的瀏覽器的例子,我已經成功地構建使用C進行二叉樹和推薦的CMakeLists.txt點雲中圖書館簡單的例子鏈接錯誤

代後,當我嘗試建立它我得到以下錯誤:

error LNK2019: unresolved external symbol "public: void __thiscall pcl::visualization::PCLVisualizer::initCameraParameters(void)" ([email protected]@[email protected]@@QAEXXZ) referenced in function "class boost::shared_ptr<class pcl::visualization::PCLVisualizer> __cdecl simpleVis(class boost::shared_ptr<class pcl::PointCloud<struct pcl::PointXYZ> const >)" ([email protected]@[email protected]@[email protected]@@@[email protected]@[email protected][email protected]@[email protected]@@[email protected]@@[email protected]@Z)` 

error LNK2019: unresolved external symbol "public: void __thiscall pcl::visualization::PCLVisualizer::addCoordinateSystem(double,int)" ([email protected]@[email protected]@@[email protected]) referenced in function "class boost::shared_ptr<class pcl::visualization::PCLVisualizer> __cdecl simpleVis(class boost::shared_ptr<class pcl::PointCloud<struct pcl::PointXYZ> const >)" ([email protected]@[email protected]@[email protected]@@@[email protected]@[email protected][email protected]@[email protected]@@[email protected]@@[email protected]@Z) 


error LNK2019: unresolved external symbol "public: bool __thiscall pcl::visualization::PCLVisualizer::setPointCloudRenderingProperties(int,double,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)" ([email protected]@[email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) referenced in function "class boost::shared_ptr<class pcl::visualization::PCLVisualizer> __cdecl simpleVis(class boost::shared_ptr<class pcl::PointCloud<struct pcl::PointXYZ> const >)" ([email protected]@[email protected]@[email protected]@@@[email protected]@[email protected][email protected]@[email protected]@@[email protected]@@[email protected]@Z) 

而這些只是一些......我錯過了cmakelists.txt中的東西?

cmake_minimum_required(VERSION 2.6 FATAL_ERROR) 

project(pcl_visualizer_viewports) 

find_package(PCL 1.5.1 REQUIRED) 

include_directories(${PCL_INCLUDE_DIRS}) 

link_directories(${PCL_LIBRARY_DIRS}) 

add_definitions(${PCL_DEFINITIONS}) 

add_executable (pcl_visualizer_demo pcl_visualizer_demo.cpp) 

target_link_libraries (pcl_visualizer_demo ${PCL_LIBRARIES}) 

任何幫助表示讚賞。謝謝

+0

UH!剛剛發生了什麼?!?這是一個醜陋而且格式不完整的問題。 – karlphillip 2012-04-26 12:36:18

+0

感謝您指出這一點...希望這是更好的現在:) – valentin 2012-04-26 12:52:52

+0

好吧,我刪除了反對票。我建議你降級到以前的版本,然後重試。我看不出您向我們顯示的信息有任何錯誤。 – karlphillip 2012-04-26 13:16:04

回答

3

發現問題所在:儘管我運行的是64位機器,但我的編譯器(VS2010)配置爲32位,因此我需要卸載64位Point Cloud Library並安裝32位版本。現在它可以工作。經驗教訓:D

+0

)編譯器可用於32位或64位,真正的區別在於您需要將CMake生成器設置爲「Visual Studio 10 Win64」而不是Visual工作室10.這將給你一個64位的SLN設置,或者只是下載32位庫,任一方法都可以。.. :) – tfinniga 2012-09-17 09:54:39

+0

我使用的是VS 2017以及32位pcl可執行文件,它們是從http:/下載的。 /unanancyowen.com/en/pcl18/。我從cmake編譯中獲得了一個成功的.sln。但是在VS 2017中構建.sln時,我得到了一個未解決的鏈接錯誤。可能是什麼原因?詳細信息也在這裏發佈 - https: //stackoverflow.com/questions/45300979/viewing-3d-point-cloud-by-integrating-custom-c-api-with-generic-point-cloud-view – 2017-07-27 13:59:37

0

它看起來像你沒有鏈接PCL庫。這可能是因爲運行CMake時${PCL_LIBRARIES}沒有適當設置。您可以在find_package調用後添加

message("PCL_LIBRARIES - ${PCL_LIBRARIES}") 

你的CMakeLists.txt文件來檢查值。

如果您使用CMake v2.8.8,this bug可能是您的問題的原因。嘗試恢復到v2.8.7

+0

謝謝你的回答。它看起來像是連接了所有的PCL庫(甚至是第三方庫)。我將你的行添加到了cmakelists.txt並檢查了它。我已經使用Cmake 2.8.7,所以我嘗試升級到2.8.8,但沒有運氣。我得到了與我使用的cmake版本相同的錯誤:(( – valentin 2012-04-26 14:26:28

0

我覺得這麼複雜可以找到一個這樣的錯誤。 我在我的電腦中安裝了PCL,Windows 7 64位和VStudio 2010,樣品運行良好。

確保已正確安裝PCL和依賴項。 請看下載部分here在我的情況下,我下載了「all in one」版本。

按照說明,一步一步,不是很複雜。

後,你可以看到如何構成的「cmake的文件」 here嘗試下載最新版本的CMake的

最後,運行基本項目的PCL網站here

有一個愉快的

一天
0

我也有同樣的問題,我通過手動鏈接pcl_visualization.lib文件解決。 一個可以嘗試以下在Visual C++ 2010的步驟:

項目屬性 - >鏈接器 - >輸入 - >附加依賴 - > 添加文件。

在我的情況,我說G:\ PCL \ PCL 1.6.0 \ LIB \ pcl_visualization_release.lib釋放和G:\ PCL \ PCL 1.6.0 \ LIB \ pcl_visualization_debug.lib爲調試。

它爲我工作。