Point Cloud Library with Visual Studio 2017
Asked Answered
T

4

7

I'm having trouble using Point Cloud Library with Microsoft Visual Studio 2017.

I have installed [PCL-1.8.1-AllInOne-msvc2017-win64.exe] and I've followed the steps mentioned here. to link it to my Visual Studio 2017 project.

My problem is that Visual Studio is not finding the header nor the source files of the library I need. The error I'm getting is as follows: [fatal error C1083: Cannot open include file: 'pcl/io/pcd_io.h': No such file or directory]

To be more precise about my problem, I need to include three PCL header files in order to run thisIterative Closest Point Tutorial

I've followed the following steps to include the PCL into my project:

  • Added the include directories to my project at the Project Properties/Configuration Properties/VC++ Directories/Include Directories field - here I specified the path to my PCL/include directory and to all 3rd party include directories (PCL/3rdParty)
  • Added the library directories on the same settings page (Library Directories field) - hereI specified the path to my PCL/lib directory and to all non-header-only 3rd party libs (Boost, Flann, VTK)
  • Chose the libs to be used in the linker. In Project Properties/Configuration Properties/Linker/Input/Additional Dependencies field. I added all the libs required. As I'm trying to run it in debug mode for now, I've picked the "_debug.lib" library files.
  • Finally, I've added the PCL/bin folder to my system path variable.

Does anyone know if I'm missing something configuration-wise?

I've seen several old posts about incompatibility between older Point Cloud Libraries and older versions of Visual Studio. As far as I understood, the new versions are supposed to work well together, but it's not the case for me.

Tole answered 13/3, 2018 at 9:24 Comment(7)
Please explain, what is failing, and how, and what you expect. As written, you are asking for guessing. We don't even know, what went wrong. Please also take the tour, and read How to Ask.Abed
Done! I hope it's better now. Thanks :)Tole
/I (Additional Include Directories).Abed
Well this didn't really solve my problem but thanks anyway. This command [CL /I \INCLUDE /I\MY\INCLUDE MAIN.C] is for the Visual Studio Command Prompt?Tole
If you cannot translate between compiler options and your IDE's GUI, you are not ready to use an IDE yet. I don't know, whether this solves your issue or not, since you never explained, what your issue is. If you get compiler or linker errors, you need to post those compiler or linker errors. All you are saying is essentially: "I'm having trouble". Not very helpful, because we know that. People don't come here to let use know, that everything is working as expected.Abed
First of all: CALM DOWN. Second, my problem is with linking the PCL library to my project. The error I get is the following : fatal error C1083: Cannot open include file: 'pcl/io/pcd_io.h': No such file or directory. And the code I'm trying to run is [this tutorial] (pointclouds.org/documentation/tutorials/…)Tole
This isn't going anywhere. Please take the tour and read How to Ask. Stack Overflow isn't a forum. Contriving a solution to a problem is not a matter of constant communicating back and forth. Instead, you are expected to provide a self-contained, concise problem statement to begin with. We have gone from "it doesn't work" through "can't access header files", "don't know how to use IDE", to finally arrive at: "I have a linker error". Nothing useful will come of this.Abed
Q
6

Installing pcl is tough because there are dozens of dependencies used along with pcl software. But with with vcpkg,a command line package manager, the installation becomes just like a one liner command.

Use Microsoft vcpkg to build a static or dynamic library for your project automatically. All the dependencies like boost,tiff,openssl,flann,szip,etc will be downloaded and installed by itself. After installing vcpkg type the following on Powershell.

.\vcpkg install pcl:x64-windows-static
Quintus answered 13/3, 2018 at 11:53 Comment(6)
Many thanks for your help. It's downloading now. Actually yes, there are tens of dependencies that were not mentioned elsewhere and that I would have never found by myself :)Tole
if you use .\vcpkg integrate install the dlls and libs will be linked automatically to your projectQuintus
Great! Now that I've used [.\vcpkg integrate install] I got this message: "All MSBuild C++ projects can now #include any installed libraries. Linking will be handled automatically. Installing new libraries will make them instantly available." Now the problem is that Visual Studio is asking to find the directory of each header file. I've tried to include the main vcpkg\packages folder (where all the headers are), but still it's unable to reach them. It seems that I have to indicate the directories to each header file in the property pages.. Any idea? ThanksTole
@Tole : You will find the header files under ...vcpkg-master\installed\x64-windows-static\includeQuintus
Yes the installation was successful. Although it stopped several times during the installation but luckily it was carrying on from where it stopped each time I restarted it. BTW, is it normal that the whole thing takes about 40 GB on the hard drive?? Now I don't have any linking problems anymore but heaps of compiler/syntax errors (106 errors) which are mainly in "centroid.h". Lots of syntax errors and undeclared identifiers..Tole
Linker errors will be visible only when compile errors are resolvedQuintus
D
3

The link you referenced is 3-4 years old. At the time, any binary build of PCL for Visual Studio 2012 or later was not provided, and thus. PCL needed to be built with target VS. And every include/library directory of PCL and any related library have to be manually added to setup the IDE. Since PCL is a large-scale collection of libraries, this made it difficult for its users to setup VS.

Now early 2018, binary builds of PCL for VS 2015/2017 and more automatic way to setup VS (e.g., adding library/include directories) using CMake are provided. Thus, installing PCL and creating a VS project using PCL does not take more than 10 minutes. I think you'd better follow the recommended way rather than setting VS by yourself.

Disaccharide answered 1/4, 2018 at 2:45 Comment(0)
M
1

the previous answer use vcpkg is good,but is better to use:

.\vcpkg install pcl:x64-windows

It can let you have fewer problems.

Metallurgy answered 10/5, 2018 at 6:8 Comment(0)
S
0

A small note for anyone who has issues with the install listed above, occasionally an install will get corrupted and not work. I got:

LINK : fatal error LNK1201

on a build, and the solution for that is find the downloaded item. This will be located in the vcpkg/downloads/ directory. Delete the item that was having issues and try the install again.

Spicy answered 11/9, 2018 at 1:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.