C++ POCO windows installation














































C++ POCO windows installation



POCO WINDOWS INSTALLATION

Following steps explains the installation process in windows

Step 1: Installing Visual studio

Microsoft Visual Studio 2015 or newer is required tobuild the POCO C++ Libraries on Windows platforms.
Visual Studio 2019 Installation
To get Visual Studio 2019, you can download it from Visual Studio Downloads. Be sure to include the C++ development tools when you install Visual Studio, because they are not installed by default. For more information about how to install Visual Studio, see Install Visual Studio.

Visual Studio 2017 Installation
To get Visual Studio 2017, you can download it from Download older versions of Visual Studio. Be sure to include the C++ development tools when you install Visual Studio, because they are not installed by default. For more information about how to install Visual Studio, see Install Visual Studio. To see the instructions for Visual Studio 2017, set the Visual Studio Version selector control to Visual Studio 2017. It's found at the top of the table of contents on the page.
Visual Studio 2015 Installation
To install Visual Studio 2015, go to Download older versions of Visual Studio. Run the setup program and choose Custom installation and then choose the C++ component.

Step 2: Download and install vcpkg

vcpkg is a command-line package manager for C++. It greatly simplifies the acquisition and installation of third-party libraries in our case the poco library.
You can download vcpkg repo from GitHub: https://github.com/Microsoft/vcpkg to any folder location you prefer.
Run the bootstrap-vcpkg.bat file in the root folder as administrator which successfully installs vcpkg in your system.

Step 3: Installing POCO libraries

To download and compile poco libraries , at the command prompt go to the folder where vcpkg was downloaded.

C:/Lenovo/user/> cd  /path/to/vcpkg
C:/path/to/vcpkg>
In 32 bit machines, run the command
C:/path/to/vcpkg> vcpkg install poco:x86-windows
In  64 bit machines, run the command
C:/path/to/vcpkg> vcpkg install poco:x64-windows

The following poco libraries require third-party
software (header files and
libraries) being installed to build properly:
 -  NetSSL_OpenSSL and Crypt require OpenSSL.
 -  Data/ODBC requires ODBC
 -  Data/MySQL requires the MySQL client.

Hence, vcpkg downloads and installs them too.
After installing all the libraries, run the below command to see all the installed libraries.

C:/path/to/vcpkg> vcpkg list

Step 4: Integrate POCO with Visual Studio

Run the below command to configure Visual Studio to locate all vcpkg header files and binaries on a per-user basis. There's no need for manual editing of VC++ Directories paths in visual studio project. All installed libraries are immediately ready to be used in your project without additional configuration.

C:/path/to/vcpkg>  vcpkg integrate install                            

Step 5: Examine for successful installation

Copy the below code as a new project in Visual studio and save the file with .cpp extension.

#include "Poco/Util/Units.h"

#include <iostream>

using namespace Poco::Util::Units::Values;

using namespace Poco::Util::Units::Constants;

int main()

{

     std::cout << "One mile is " << km(mile(1)) << std::endl;

     m l = cm(42);

     std::cout << cm(42) << " == " << l << " == " << milli(l) << std::endl;

     std::cout << "Area of circle with radius" << l <<" is " << m2(square(l) * pi) << std::endl;

     return 0;

}

And verify the output.

OUTPUT

One mile is 1.60934 km
42 cm == 0.42 m == 420 mm
Area of
circle with radius 0.42 m is 0.554177 (m)^2


NOTE : For errors like 'cannot open source file' or 'cannot open header file', go to project properties->platform and change to x86 for 32bit machine and x64 for 64bit machine. This resolves the error (if the path is valid).


Comments