0
votes

I am trying to use this PCL library, and downloaded the all-in-one installer(1.8.1-mscv2017-win64). Added all the directories for the "Include Directories".

Added all the corresponding library folders to the "Library Directories".

System Path checked.

But it still gives me about 30 Link errors, like the following two:

LNK2019 unresolved external symbol "void __cdecl pcl::console::print(enum pcl::console::VERBOSITY_LEVEL,char const *,...)" (?print@console@pcl@@YAXW4VERBOSITY_LEVEL@12@PEBDZZ) referenced in function "public: void __cdecl pcl::detail::FieldMapper<struct pcl::PointXYZRGBA>::operator()<struct pcl::fields::rgba>(void)" (??$?RUrgba@fields@pcl@@@?$FieldMapper@UPointXYZRGBA@pcl@@@detail@pcl@@QEAAXXZ)    RealSensewithPCL

LNK2001 unresolved external symbol "public: virtual int __cdecl pcl::PCDReader::readHeader(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,struct pcl::PCLPointCloud2 &,class Eigen::Matrix<float,4,1,0,4,1> &,class Eigen::Quaternion<float,0> &,int &,int &,unsigned int &,int)" (?readHeader@PCDReader@pcl@@UEAAHAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAUPCLPointCloud2@2@AEAV?$Matrix@M$03$00$0A@$03$00@Eigen@@AEAV?$Quaternion@M$0A@@7@AEAH4AEAIH@Z)
1

1 Answers

1
votes

Here is the update for my issues about the link errors after the steps I mentioned in the post:

  1. Add all the directories for the "Include Directories".
  2. Add all the corresponding library folders to the "Library Directories".

The link error LNK2019 is caused by the missing dependencies ('.lib' files). Best way to add them is same as the method mentioned in this post: In visual studio how to include all .libs in a folder

Basically, go to Properties->Configuration Properties->Linker->Command Line, add the path of all the ".lib" files to the "Additional Options".

Make sure you only add the right .lib files for your current Config (Debug or Release). For the "Debug" mode, you need add the .lib files with "gd" or "debug" in their filenames. Otherwise, you may have new link errors(LNK2038) similar to this one:

LNK2038 mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in cloud_viewer.obj        

Here is what I put in my command line(All paths are separated by space):

"C:\Program Files\PCL 1.8.1\3rdParty\VTK\lib\*gd.lib" "C:\Program Files\PCL 1.8.1\3rdParty\Boost\lib\*gd-1_64.lib" "C:\Program Files\PCL 1.8.1\3rdParty\FLANN\lib\*gd.lib" "C:\Program Files\PCL 1.8.1\lib\*_debug.lib"

Hope this answer can free you from the struggling of setting things up and start rolling!