0

I am trying to setup PCL 1.8.1 library from https://github.com/PointCloudLibrary/pcl/releases in Visual Studio 2017.

In my Include Directories I have:

C:\Program Files (x86)\OpenNI2\Include
C:\Program Files (x86)\PCL 1.8.1\3rdParty\VTK\include\vtk-8.0
C:\Program Files (x86)\PCL 1.9.1\3rdParty\Qhull\include
C:\Program Files (x86)\PCL 1.8.1\3rdParty\FLANN\include
C:\Program Files (x86)\PCL 1.8.1\3rdParty\Eigen\eigen3
C:\Program Files (x86)\PCL 1.8.1\3rdParty\Boost\include\boost-1_64
C:\Program Files (x86)\PCL 1.8.1\include\pcl-1.8

Library Directories:

C:\Program Files (x86)\PCL 1.8.1\3rdParty\VTK\lib
C:\Program Files (x86)\PCL 1.8.1\3rdParty\Qhull\lib
C:\Program Files (x86)\PCL 1.8.1\3rdParty\FLANN\lib
C:\Program Files (x86)\PCL 1.8.1\3rdParty\Boost\lib
C:\Program Files (x86)\PCL 1.8.1\lib
C:\Program Files (x86)\OpenNI2\Lib

Which I assume is all correct. I am able to build and run a simple example like http://pointclouds.org/documentation/tutorials/writing_pcd.php#writing-pcd. My main need is to use Fdtrees and Octrees, however when I try to compile this example http://pointclouds.org/documentation/tutorials/kdtree_search.php#kdtree-search, I got LNK2019 errors: LNK2019 errors screenshot

As you can see, it is all related to FLANN library. I discovered that even when I delete C:\Program Files (x86)\PCL 1.8.1\3rdParty\FLANN\lib from Include Libraries, the same errors occur. Am I not including the library correctly?

Also this post: Setting up Point Cloud Library with Visual Studio mentions adding .libs in Linker/Input/Additional Dependencies. I tried doing that aswell like:

C:\Program Files (x86)\PCL 1.8.1\3rdParty\FLANN\lib\flann.lib
C:\Program Files (x86)\PCL 1.8.1\3rdParty\FLANN\lib\flann_cpp.lib
C:\Program Files (x86)\PCL 1.8.1\3rdParty\FLANN\lib\flann_cpp_s.lib
C:\Program Files (x86)\PCL 1.8.1\3rdParty\FLANN\lib\flann_cpp_s-gd.lib
C:\Program Files (x86)\PCL 1.8.1\3rdParty\FLANN\lib\flann_cpp-gd.lib
C:\Program Files (x86)\PCL 1.8.1\3rdParty\FLANN\lib\flann_s.lib
C:\Program Files (x86)\PCL 1.8.1\3rdParty\FLANN\lib\flann_s-gd.lib
C:\Program Files (x86)\PCL 1.8.1\3rdParty\FLANN\lib\flann-gd.lib

And also without the full paths, but still no success...

I am really trying to make this work and also UNDERSTAND the whole process of including external stuff in Visual Studio / C++. I am quite new to this and it is definitely a more complicated process than Python's "pip install xyz, import xyz"... Bud I hate when something is a black box to me and would really like to get my head around this.

Sorry if this post was too long, but I wanted to provide every detail. THANK YOU for any answer.

drescherjm
  • 10,365
  • 5
  • 44
  • 64
Roppard
  • 11
  • 5
  • You can copy and paste the text of the error messages from the Output Tab. That is in a better format than the Errors List. – drescherjm Nov 27 '18 at 21:29
  • You are adding more libs than necessary. Also I suspect you must have different libs between debug and release. And make sure that the binaries were built with your compiler or VS2015. Binaries from any other compiler (including older versions of Visual Studio) will not be compatible. – drescherjm Nov 27 '18 at 21:32
  • Hello there, thank you. very much for your answer! By binaries you mean the .lib or .dll files? Because there are some .dlls in "bin" folders inside the main PCL library folder and in 3rd party libraries too. I am unsure of what to do with those (I am not using them at all at the moment) – Roppard Nov 28 '18 at 14:54
  • I mean `.lib`. I don't believe `flann_cpp.lib` and `flann_cpp_s.lib` or `flann_cpp-gd.lib` should be used at the same time. the _s and _gd are for different CRTs. – drescherjm Nov 28 '18 at 15:15
  • _s = static release library _s_gd = static debug library. Without the _s means use the dll. _gd means debug. – drescherjm Nov 28 '18 at 15:19
  • Also make sure you use debug libraries for the debug configuration and release libraries for the release configuration. You can't mix and match. – drescherjm Nov 28 '18 at 15:21
  • Thanks for info, good to know that .libs are distinguished in such a way. I tried having only flann_cpp_s-gd.lib and flann_s-gd.lib in my Linker/Input/Additional Dependencies, but the linker error still prevails :/ – Roppard Nov 28 '18 at 22:16

1 Answers1

0

I actually managed to solve this! The problem was that I did not hook up "pcl_kdtree_debug.lib", includes for the FLANN library were OK after all. From the linker errors it wast just very unclear what it actually needs. I figured it out while using a totally different library for a different thing which had a similar issue.

Thanks drescherjm! You played your role in this.

Roppard
  • 11
  • 5