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

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

Related

Install Point Cloud Library

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

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.

MSBuild to apply a nuget package to a project at build time

I have a cmake project that builds fine on Linux and that I want to build also on Windows. The code is portable and is made of C++ so... it should build. The only thing is that, on Windows, I need to use nuget to restore some packages, cpprestsdk is one of them. Now when I run
cmake .
CMake will generate solution files and projects files that I don't want to include in my VCS at all. The thing I want MSBuild to do is to apply the packages contained in my packages.config to all the project files found in the project directory.
Anyone knows how?
The thing I want MSBuild to do is to apply the packages contained in my packages.config to all the project files found in the project directory. Anyone knows how?
I am afraid you can not do such things. That because whether you are using MSBuild or NuGet to do this thing, you have to use to the nuget.exe to do it. However, install nuget packages to the project file relies on VS capabilities not nuget.exe and nuget team not plan to bring it to the exe.
The NuGet Command Line does not actually install any packages. The install command is actually doing a restore operation.
This means that nuget.exe install will only download and extract the package into the output location. It will not modify the project file. Although, the package manager console seem to offer "Install-Package" for doing this, but you have to open each project files with Visual Studio and execute Install-Package in the package manager console for each project files, which is not what you want. So you could not enable this script outside of visual studio.
So we could not use MSBuild to apply the packages contained in the packages.config to all the project files found in the project directory.
You can refer to this thread and this thread for details.
Hope this helps.

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 =)