【发布时间】:2012-12-17 06:34:57
【问题描述】:
我正在尝试使用 Open Point Cloud 库来对齐点云。我使用 Visual Studio 2012 并创建了一个新的 Visual c++ 项目。 在项目的属性中添加存放PCL所有.libs的目录(Properties -> c/c++ -> general->附加包含目录) 我要使用的库列在属性 -> 链接器 -> 输入 -> 附加依赖项中
我写到现在的代码很简单:
#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/point_cloud.h>
int main(int argc, char** argv)
{
//creates a PointCloud<PointXYZ> boost shared pointer and initializes it
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_src (new pcl::PointCloud<pcl::PointXYZ>);
//load Pointsclouds from PCD-Files
pcl::io::loadPCDFile<pcl::PointXYZ> ("pcd_ascii.pcd", *cloud_src); // <- at this point the error occurs
}
我刚刚按照本教程进行操作: http://pointclouds.org/documentation/tutorials/reading_pcd.php
我包含了正确的库和文件……尤其是“pcd_io.h”,为什么会出现链接器错误?我要加载的 pcd 文件与 cpp 文件位于同一文件夹中。我是否以错误的方式处理库?
链接错误 Fehler 28 错误 LNK2020: Nicht aufgel÷stes 令牌 (0A000C90) "void __cdecl pcl::console::print(enum pcl::console::VERBOSITY_LEVEL,char const *,...)" (?print@console@pcl@ @$$FYAXW4VERBOSITY_LEVEL@12@PBDZZ)。 D:\Documents\\Code\PCL_cpp\pcl_cpp\pcl_cpp\pcl_registration.obj pcl_cpp
Fehler 29 错误 LNK2020: Nicht aufgel÷stes Token (0A000CBD) "void __cdecl pcl::console::print(enum pcl::console::VERBOSITY_LEVEL,char const *,...)" (?print@console @pcl@@$$FYAXW4VERBOSITY_LEVEL@12@PBDZZ)。 D:\Documents\代码\PCL_cpp\pcl_cpp\pcl_cpp\pcl_registration.obj pcl_cpp
Fehler 30 错误 LNK2001: Nicht aufgel÷stes externes Symbol ""public: virtual int __thiscall pcl::PCDReader::readHeader(class std::basic_string,class std::allocator > const &,struct sensor_msgs::PointCloud2 & ,class Eigen::Matrix &,class Eigen::Quaternion &,int &,int &,unsigned int &,int)" (?readHeader@PCDReader@pcl@@UAEHABV?$basic_string@DU?$char_traits@D@std @@V?$allocator@D@2@@std@@AAUPointCloud2@sensor_msgs@@AAV?$Matrix@M$03$00$0A@$03$00@Eigen@@AAV?$Quaternion@M$0A@@8@AAH4AAIH @Z)"。 D:\Documents\代码\PCL_cpp\pcl_cpp\pcl_cpp\pcl_registration.obj pcl_cpp
Fehler 31 错误 LNK2001: Nicht aufgel÷stes externes Symbol ""public: virtual int __thiscall pcl::PCDReader::read(class std::basic_string,class std::allocator > const &,struct sensor_msgs::PointCloud2 & ,class Eigen::Matrix &,class Eigen::Quaternion &,int &,int)" (?read@PCDReader@pcl@@UAEHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@ D@2@@std@@AAUPointCloud2@sensor_msgs@@AAV?$Matrix@M$03$00$0A@$03$00@Eigen@@AAV?$Quaternion@M$0A@@8@AAHH@Z)"。 D:\Documents\代码\PCL_cpp\pcl_cpp\pcl_cpp\pcl_registration.obj pcl_cpp
Fehler 32 错误 LNK2001: Nicht aufgel÷stes externes Symbol ""void __cdecl pcl::console::print(enum pcl::console::VERBOSITY_LEVEL,char const *,...)" (?print@console@ pcl@@$$FYAXW4VERBOSITY_LEVEL@12@PBDZZ)"。 D:\Documents\Code\PCL_cpp\pcl_cpp\pcl_cpp\pcl_registration.obj pcl_cpp
错误在德语中的“Nicht aufgelöstes”表示未解决 关于您对正确安装的评论...我不舒尔,所以我再次下载并安装了它。它是 64 位“Windows MSVC 2010(64 位)”的完整安装程序 安装后我得到相同的结果。
【问题讨论】:
-
您是否为您的架构(x86/x64)使用正确的 PCL 安装?
-
不要让我们猜测链接器错误。它们旨在帮助诊断问题。如果我们看不到它们,我们就不能这样做。
-
对不起,我忘记将它们添加到描述中。感谢您的快速回复
-
PCL 头文件文件夹应包含在(属性->VC++ 目录->包含目录)中,库文件文件夹应包含在(属性->VC++ 目录->库目录)中。你已经这样做了吗?从你的描述看不是很清楚。
-
谢谢!您最后的提示 --> Properties-->VC 解决了 Linker-Error
标签: visual-c++ visual-studio-2012 linker-errors lnk point-cloud-library