I can't do simple compilation (pcd_read.cpp), VTK not found. What am I doing wrong?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

I can't do simple compilation (pcd_read.cpp), VTK not found. What am I doing wrong?

tambui
:warning: This is a issue tracker, please use our mailing list for questions:
www.pcl-users.org. :warning:


I am new to the point cloud library and all of its dependencies.  All I want
to do is compile something simple like  pcd_read.cpp
<http://www.pointclouds.org/documentation/tutorials/reading_pcd.php#reading-pcd>
.  Whenever I run cmake, it gives me an error about the VTK not being found.
I have attached the pcd_read.cpp, CMakeLists.txt, and the build output from
running "cmake .." inside the build folder.

What started out as a warning turned into an error towards the end of the
build:
<http://www.pcl-users.org/file/t499130/33582190-e461581e-d908-11e7-8807-c86905b0d14c.png>

## Your Environment

* Operating System and version: Windows 10 Insider Preview 17064 and Windows
8.1 Version 6.3 (Build 9600)
* Compiler: Microsoft Visual Studio 2017 and Microsoft Visual Studio 2015
compilers
* PCL Version:  1.8.1
<https://github.com/PointCloudLibrary/pcl/releases/tag/pcl-1.8.1>  ,
specifically installed PCL-1.8.1-AllInOne-msvc2017-win64.exe on a Windows 10
machine and PCL-1.8.1-AllInOne-msvc2015-win64 on a Windows 8.1 machine
* CMake Version:  3.10.0
<https://cmake.org/files/v3.10/cmake-3.10.0-win64-x64.msi>   (x64 version)

## Expected Behavior
I followed the  instructions on creating the CMakeLists.txt file
<http://www.pointclouds.org/documentation/tutorials/reading_pcd.php#reading-pcd>
and running cmake for the pcd_read example, and I expected the build to
complete successfully.  

## Current Behavior
However, on both a Windows 10 and Windows 8.1 system, I get a VTK
warning/error saying that it can't resolve VTK (details are in the attached
build logs and the above screenshot).  I assume the VTK is installed as part
of the PCL-1.8.1-AllInOne-msvc2017-win64.exe all-in-one executable.

## Possible Solution
I need help with this

## Code to Reproduce
Code and cmake build output can be found in the attached zip here:
https://github.com/PointCloudLibrary/pcl/files/1529158/PcdConverter.zip


## Context

I really want to make use of the point cloud library but I can't even get it
to compile a simple console app.  All I want it to do is compile something,
anything.


N/A




--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: I can't do simple compilation (pcd_read.cpp), VTK not found. What am I doing wrong?

tambui
So I went another way, and got it to compile using Visual Studio 2017 instead
of the command line approach.  In case anyone else needs this, I'll leave
the instructions here below.

PCL 1.8.1 All-In-One Installer 64-bit:
https://github.com/PointCloudLibrary/pcl/releases/download/pcl-1.8.1/PCL-1.8.1-AllInOne-msvc2017-win64.exe
<https://github.com/PointCloudLibrary/pcl/releases/download/pcl-1.8.1/PCL-1.8.1-AllInOne-msvc2017-win64.exe>  

Create a VC++ Console App Project, then add this code to the main cpp file:
http://pointclouds.org/documentation/tutorials/reading_pcd.php#reading-pcd
<http://pointclouds.org/documentation/tutorials/reading_pcd.php#reading-pcd>  
        #include <iostream>
        #include <pcl/io/pcd_io.h>
        #include <pcl/point_types.h>

        int main (int argc, char** argv)
        {
          pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new
pcl::PointCloud<pcl::PointXYZ>);

          if (pcl::io::loadPCDFile<pcl::PointXYZ> ("test_pcd.pcd", *cloud) == -1)
//* load the file
          {
                PCL_ERROR ("Couldn't read file test_pcd.pcd \n");
                return (-1);
          }
          std::cout << "Loaded "
                                << cloud->width * cloud->height
                                << " data points from test_pcd.pcd with the following fields: "
                                << std::endl;
          for (size_t i = 0; i < cloud->points.size (); ++i)
                std::cout << "    " << cloud->points[i].x
                                  << " "    << cloud->points[i].y
                                  << " "    << cloud->points[i].z << std::endl;

          return (0);
        }

Make sure you are compiling as "Release" "x64".

Right-click on the project in Solution Explorer and choose Properties, then
set the following
Project Configuration Properties:
VC++ Directories:
• Include Directories:
  o C:\Program Files\PCL 1.8.1\3rdParty\VTK\include
  o C:\Program Files\PCL 1.8.1\3rdParty\Qhull\include
  o C:\Program Files\PCL 1.8.1\3rdParty\FLANN\include
  o C:\Program Files\PCL 1.8.1\3rdParty\Eigen\eigen3
  o C:\Program Files\PCL 1.8.1\3rdParty\Boost\include\boost-1_64
  o C:\Program Files\PCL 1.8.1\include\pcl-1.8
• Library Directories:
  o C:\Program Files\PCL 1.8.1\lib
  o C:\Program Files\PCL 1.8.1\3rdParty\VTK\lib
  o C:\Program Files\PCL 1.8.1\3rdParty\FLANN\lib
  o C:\Program Files\PCL 1.8.1\3rdParty\Boost\lib
C/C++:
• Additional Include Directories:
  o C:\Program Files\PCL 1.8.1\3rdParty\VTK\include
  o C:\Program Files\PCL 1.8.1\3rdParty\Qhull\include
  o C:\Program Files\PCL 1.8.1\3rdParty\FLANN\include
  o C:\Program Files\PCL 1.8.1\3rdParty\Eigen\eigen3
  o C:\Program Files\PCL 1.8.1\3rdParty\Boost\include\boost-1_64
  o C:\Program Files\PCL 1.8.1\include\pcl-1.8
• Precompile Headers
  o Precompile Header: Not Using Precompiled Headers
Linker:
• Input:
  o Additional Dependencies
     pcl_common_release.lib
     pcl_io_release.lib
     libboost_thread-vc141-mt-1_64.lib
     libboost_system-vc141-mt-1_64.lib
     libboost_date_time-vc141-mt-1_64.lib
     libboost_chrono_vc141-m5-1_64.lib
     libboost_filesystem-vc141-mt-1_64.lib
     libboost_iostreams-vc141-mt-1_64.lib

Compile the code and it should work.




--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users