Install Point Cloud Library - c++

I've recently been introduced to vcpkg as I've been looking for the best way to install Point Cloud Library (PCL) in order to use it in my Visual Studio C++ project.
I've installed PLC static libraries using .\vcpkg install pcl:x64-windows-static and then .\vcpkg integrate install to integrate the libs and dlls to Visual Studio 2017. My goal for now is to run the demo of Iterative Closest Point Algorithm on the official PCL website.
I have created a virgin project and I've done the following to add PCL:
Added "vcpkg-master\installed\x64-windows-static\include" path to Property Page->VC++ directories->Include Directories
Added "vcpkg-master\installed\x64-windows-static\include" path to Property Page
->C/C++ ->Additional Include Directories
Added the all the lib files (the ones in vcpkg-master\installed\x64-windows-static\lib)to Property Page->Linker->Additional Dependencies
Added "vcpkg-master\installed\x64-windows-static\lib" path to Property Page->Linker->General->Additional Library Directories
I'm trying to compile the previously mentioned demo in Debug x86 mode but I keep getting the following error:
1>LINK : fatal error LNK1104: cannot open file 'manual-link.obj'
Please note that in the installed PCL directories, there are two folders called manual-link.
The first one is "vcpkg-master\installed\x64-windows-static\debug\lib\manual-link" and contains two lib files:
boost_prg_exec_monitor-vc140-mt-gd.lib
boost_test_exec_monitor-vc140-mt-gd.lib
The other one is "vcpkg-master\installed\x64-windows-static\lib\manual-link" and includes:
boost_prg_exec_monitor-vc140-mt.lib
boost_test_exec_monitor-vc140-mt.lib
I don't know what I'm missing here. Has anybody experienced the same problem with PCL and Visual Studio 2017? Any solutions to this problem?

The x64-windows-static triplets won't be automatically selected[1] -- you need to edit your MSBuild vcxproj and set the VcpkgTriplet MSBuild property to x64-windows-static:
<PropertyGroup Label="Globals">
<!-- .... -->
<VcpkgTriplet Condition="'$(Platform)'=='Win32'">x86-windows-static</VcpkgTriplet>
<VcpkgTriplet Condition="'$(Platform)'=='x64'">x64-windows-static</VcpkgTriplet>
</PropertyGroup>
Note that you will also need to change to static link the CRT (/MT) if you do this.
Alternatively, you can install the dynamic libraries (x64-windows) and they will be automatically picked up by default and work with the settings for your new project without any changes.
Either way, you should not need to add any paths to your Additional Include Directories or to your Additional Dependencies.
[1] https://github.com/Microsoft/vcpkg/blob/master/docs/users/integration.md#triplet-selection

Related

Using Tesseact OCR in an existing Visual Studio C++ project

I want to use the Tesseract-OCR library with my already existing C++ project. I followed the steps mentioned in this answer.
I cloned the Github repo from here
Ran the build_tesseract.bat
Opened 'tesseract.sln' and set 'tesseract' as startup project before compiling it
for both 'release' and 'debug' configurations
After successful compilation, under the folder 'debug' and 'release', I have a list of .lib files
Now I don't know how to move forward from here. I am used to adding libraries that have 'include' directories. Here, I am not able to find such directories except the .lib files for both 'debug' and 'release' configuration.
Can someone point me to how to use these files to add the 'tesseract-OCR' API to my existing project?
For anyone looking to use Tesseract-OCR with Visual Studio 2017+, I found an alternative method(Not exactly, It was straight to my face all along).
Using VcPkg seems to be the best and easiest way as mentioned in Tesseract-OCR documentation itself.
Install VcPkg from the instruction here
Navigate to the installation folder or Add the VcPkg to the 'PATH' variable
Run the command vcpkg install tesseract:x64-windows. It might take 30 to 40 mins depending on your system
Under the 'Installed' folder, you will find 'include', 'lib' & 'bin' folders for all Visual Studio configurations
Using this, you can add Tesseract-OCR to your existing Visual Studio project

Point Cloud Library with Visual Studio 2017

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.
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
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.
the previous answer use vcpkg is good,but is better to use:
.\vcpkg install pcl:x64-windows
It can let you have fewer problems.
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.

Visual C++ nuget: boost include files not found

I'm pretty new to visual studio as I usually work in linux.
I installed boost package via nuget and I can see all the headers files installed correctly into my solution's 'packages' folder.
However whenever I try to include a boost header I get an error, e.g:
Cannot open include file: 'boost/type_traits/has_equal_to.hpp': No such file or directory
At the same time I installed SFML libraries and those work perfectly.
Also I noticed, that in my project properties, 'Referenced Packages' section SFML libraries are listed, but boost ones are not. This is strange, because when I installed the packages I did click the checkboxes for the projects I installed the packages for.
I tried hard to find how to add package references but miserably failed. I'm probably just being thin here...
I'm using Visual Sudio 14 (2015) Update 3 Community Edition.
You need to add the following path:
$(SolutionDir)\packages\boost.w.x.y.z\lib\native\include\boost
in Configuration Properties > C/C++ > General > Additional Include Directories

How to set up [ ZeroMQ ] for use in a Visual Studio 2015 Enterprise?

While my primary domain of expertise is not Visual Studio 2015 setup / project configuration, I have experienced troubles on loading / configuring ZeroMQ project.
How to proceed correctly on loading a ZeroMQ Project?
Observed errors:
current build on github and even old "stable" versions cause cmake errors
ZeroMQ Installer does not support Visual Studio v14
Instructions would be awesome, as it seems that there is no other source of documentation for this situation on the internet.
Had the same problem a while ago. Here is what I did to solve this:
Download the right ZMQ version
The "download link" provided on the ZMQ website seems outdated.
To really get the current version you would have to use Git:
git clone https://github.com/zeromq/libzmq.git
Build with Visual Studio 2015
The repository comes with a pre-build Visual Studio project. You can find it in ...\libzmq\builds\msvc. To build for Visual Studio 2015 cd into vs2015 and open libzmq.sln.
You can choose if you want to compile static or dynamic libraries: DynRelease or StaticRelease for either Win32 or x64.
After that, run Build > Build solution to compile everything.
Setup project to use compiled libraries
After you created your project, go to the project's properties:
C++ > General > Additional Include Directories should point to the include path of the repository. If you want to use C++ style some additional files have to be placed in this directory. Alternatively you can take a look at https://github.com/zeromq/zmqpp.
Linker > General > Additional Library Directories should point to the built libraries. They should be located at ...\libzmq\bin\x64\Release\v140\dynamic\.
Linker > Input > Additional Dependencies should contain the name of the library you want to use. The default should be libzmq.lib, otherwise you will find the name in the bin directory.
The program depends on the libzmq.dll file you just built. This file has to be placed within your project's build directory. To achieve this, you can add the following command to Build Events > Post-Build Event > Command Line:
copy /Y "...\libzmq\bin\x64\Release\v140\dynamic\libzmq.dll" "$(OutDir)"
This will copy the .dll file to the destination directory on every build if it's missing.
Hope this helps =)

GStreamer C++ on Visual Studio 2010?

Following instructions on http://docs.gstreamer.com/display/GstSDK/Installing+on+Windows to install GStreamer and compile tutorials/examples on Windows 7, for compilation using Visual Studio 2010.
After installing the SDKs, I try to compile the "hello world" example...
Cannot open include file: 'gst/gst.h': No such file or directory.
Odd - the tutorials were supposedly configured with the paths to these files. Nevertheless, we can manually add them...
Add C:\gstreamer-sdk\0.10\x86\include\gstreamer-0.10 to project include directories
Cannot open include file: 'glib.h': No such file or directory
Add C:\gstreamer-sdk\0.10\x86\include\glib-2.0 to project include directories
Cannot open include file: 'glibconfig.h': No such file or directory
At this point it seems to be a dead-end, as there isn't a glibconfig.h file anywhere on PC.
Was some step missing from the gstreamer documents?
p.s. I see a similar question, but its accepted answer seems to be a dead-link.
This question was posted on 2014. However, for everyone that needs to install Gstreamer on Visual Studio , I am explaining how you configure your library on Windows.
First of you need to download the library from https://gstreamer.freedesktop.org/data/pkg/windows/
You need to download and install both installers for developers and non-developers.
For instance for 1.14 it is the now latest version,
gstreamer-1.0-devel-x86-1.14.1.msi
gstreamer-1.0-x86-1.14.1.msi
You will install and setup both of them in the same directory like C:\gstreamer. (I guess gstreamer automatically adds its /bin to the Path environment. If not just ask it.)
After that you will open your Visual Studio. Create your C++ project. Create your main.cpp file. Right click on your project and click properties.
We need to do 3 steps:
Include the necessary directory paths.
Define the where the .lib paths are.
Specify which .libs you want to use.
After clicking properties:
C/C++ -> Additional Include Directories -> define your include paths such as
C:\gstreamer\1.0\x86_64\lib\glib-2.0\include;C:\gstreamer\1.0\x86_64\include\gstreamer-1.0;C:\gstreamer\1.0\x86_64\include\glib-2.0\;C:\gstreamer\1.0\x86_64\include\glib-2.0\glib;%(AdditionalIncludeDirectories)
Linker -> General -> Adding Library Directories -> write your lib directory path such as
C:\gstreamer\1.0\x86_64\lib;%(AdditionalLibraryDirectories)
Linker -> Input -> Additional Dependencies -> Write your .lib files you want to use such as
gobject-2.0.lib;glib-2.0.lib;gstreamer-1.0.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
gobject-2.0.lib;glib-2.0.lib;gstreamer-1.0.lib are the ones we added, others are done by default.
That's all. You can just write in your main.cpp file
#include <gst/gst.h> and use your GStreamer Library
I think this will work for almost all libraries.
(1) Install Windows Driver Development Kit
(2) When creating new projects, use the "gstreamer" template in Visual Studio, rather than the "Windows application" template. Then it doesn't need anything changing in the include/linker settings to make #include <gst/gst.h> work properly.
The standard gstreamer installation on windows has a glibconfig.h located in: (assuming your gstreamer installation is in C:\gstreamer) C:\gstreamer\1.0\x86_64\lib\glib-2.0\include
The official way is using the "Property Sheet" feature of Visual Studio.
In Visual Studio, click View→Property Manager or View→Other Windows→Property Manager on the menu bar.
Click Property Manager tab near the Solution Explorer.
Right click your project name and choose Add Existing Property Sheet..., and navigate to %GSTREAMER_ROOT_X86%\share\vs\2010\libs and load gstreamer-1.0.props.
This will add Addittional Include Directories, Addittional Libraries Directories and Additional Dependencies to your Project Properties.
Build your project.
Sources:
Creating new projects manually:
https://gstreamer.freedesktop.org/documentation/installing/on-windows.html?gi-language=c#creating-new-projects-manually
Share or reuse Visual Studio project settings:
https://learn.microsoft.com/en-us/cpp/build/create-reusable-property-configurations