POCO C++ lib开发环境构建

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介: Welcome   Thank you for downloading the POCO C++ Libraries and welcome to the growing community of POCO C++ Libraries users.

Welcome

 

Thank you for downloading the POCO C++ Libraries and welcome to the growing community of POCO C++ Libraries users. This document will help you in getting a smooth ride while installing and setting up the POCO C++ Libraries and going the first steps with the software.

 

 

Setting Up The POCO C++ Libraries

 

The POCO C++ Libraries are delivered in full source code only. Due to the large number of possible build configurations, no binary releases are provided from the project maintainers. This means that you have to build the libraries and tools before you can use them the first time.

Note: There are binary releases available as installation packages for various operating systems (e.g., Debian Linux, Ubuntu Linux, OpenBSD, OpenWRT, etc.). However, these packages are not maintained by the core team and may not always be up to date.

 

 

Source Code Distribution Format

 

The source code for the POCO C++ Libraries is delivered in a ZIP file for Windows users and/or in a compressed TAR file (.tar.gz or .tar.bz2) for Unix/Linux users. Both archives contain the same files, the only difference is that all text files in the ZIP files have line endings suitable for Windows (CR-LF), while the text files in the TAR file have line endings suitable for Unix/Linux (LF only). All libraries and tools follow a common convention for the directory layout. This directory layout is shown below.

 

build/                     the build system for Unix/OpenVMS and additional utility scripts
    config/                build configurations for various Unix platforms
    rules/                 common build rules for all platforms
    scripts/               build and utility scripts
    vms/                   OpenVMS build system scripts
    vxconfig/              VxWorks build configurations

bin/                       all executables (dynamic link libraries on Windows)
bin64/                     all 64-bit executables (and DLLs)

doc/                       additional documentation

lib/                       all libraries (import libraries on Windows)
lib64/                     all 64-bit libraries

CppUnit/                   project and make/build files for the CppUnit unit testing framework
    doc/                   additional documentation
    include/
        CppUnit/           header files for CppUnit
    src/                   source files for CppUnit
    WinTestRunner/         Windows GUI for CppUnit

Foundation/                project and make/build files for the Foundation library
    include/
        Poco/              header files for the Foundation library
    src/                   source files for the Foundation library
    testsuite/             project and make/build files for the Foundation testsuite
        src/               source files for the Foundation testsuite
        bin/               test suite executables
    samples/               sample applications for the Foundation library

XML/                       project and make/build files for the XML library
    include/
        Poco/
            XML/           header files for the core XML library
            SAX/           header files for SAX support
            DOM/           header files for DOM support
    src/                   source files for the XML library
    testsuite/             project and make/build files for the XML testsuite
        src/               source files for the XML testsuite
        bin/               test suite executables
    samples/               sample applications for the XML library

Net/                       project and make/build files for the Net library
    include/
        Poco/
            Net/           header files for the Net library
    src/                   source files for the Net library
    testsuite/             project and make/build files for the Net testsuite
        src/               source files for the Net testsuite
        bin/               test suite executables
    samples/               sample applications for the Net library

 

Depending on what package you have downloaded (Basic or Complete Edition), there may be other libraries as well (such as Data, Crypto, NetSSL_OpenSSL and Zip).

 

 

External Dependencies

 

The following libraries require third-party software (header files and libraries) being installed to build properly:

 

  • NetSSL_OpenSSL and Crypt require OpenSSL.
  • Data/ODBC requires ODBC (Microsoft ODBC on Windows, unixODBC or iODBC on Unix/Linux)
  • Data/MySQL requires the MySQL client.

 

 

OpenSSL

 

Most Unix/Linux systems (including Mac OS X) already have OpenSSL preinstalled, or OpenSSL can be easily installed using the system’s package management facility. For example, on Ubuntu (or other Debian-based Linux distributions) you can type

 

$ sudo apt-get install openssl libssl-dev

 

to install the necessary packages. If your system does not have OpenSSL, please get it from http://www.openssl.org/ or another source. You do not have to build OpenSSL yourself — a binary distribution is fine.

The easiest way to install OpenSSL on Windows is to use a binary (prebuild) release, for example the one from Shining Light Productions that comes with a Windows installer (http://www.slproweb.com/products/Win32OpenSSL.html). Depending on where you have installed the OpenSSL libraries, you might have to edit the build script (buildwin.cmd), or add the necessary paths to the INCLUDE and LIB environment variables. You might also have to edit the project settings if the names of the OpenSSL libraries from your build differ from the names used in the project files.

 

 

ODBC

 

The Data library requires ODBC support on your system if you want to build the ODBC connector (which is the default). On Windows platforms, ODBC should be readily available if you have the Windows SDK installed. On Unix/Linux platforms, you can use iODBC (preinstalled on Mac OS X) or unixODBC. On Linux, use your distribution's package management system to install the necessary libraries and header files. For example, on Ubuntu, type

 

$ sudo apt-get install libiodbc2 libiodbc2-dev

 

to install the iODBC library and header files.

The Data/ODBC and Data/MySQL Makefiles will search for the ODBC and MySQL headers and libraries in various places. Nevertheless, the Makefiles may not be able to find the headers and libraries. In this case, please edit the Makefile in Data/ODBC and/or Data/MySQL accordingly.

 

 

MySQL Client

 

The Data library requires the MySQL client libraries and header files if you want to build the MySQL connector (which is the default). On Windows platforms, use the MySQL client installer to install the necessary files. On Unix/Linux platforms, use the package management system of your choice to install the necessary files. Alternatively, you can of course build MySQL yourself from source.

 

 

Building On Windows

 

Microsoft Visual Studio 7.1 (2003), 8.0 (2005), 9.0 (2008) or 10.0 (2010) is required to build the POCO C++ Libraries on Windows platforms. Solution and project files for all versions are included. For Visual Studio 2008 and 2010, 64-bit (x64) builds are supported as well. You can either build from within Visual Studio (Build->Batch Build->Select All;Rebuild) or from the command line. To build from the command line, start the Visual Studio .NET 2003/2005/2008/2010 Command Prompt and go (cd) to the directory where you have extracted the POCO C++ Libraries sources. Then, simply start the buildwin.cmd script and pass as argument the version of visual studio (71, 80, 90 or 100). You can customize what is being built by buildwin.cmd by passing appropriate command line arguments to it. Call buildwin.cmd without arguments to see what is available.

To disable certain components (e.g., NetSSL_OpenSSL or Data/MySQL) from the build, edit the text file named components in the distribution root directory and remove the respective lines.

Certain libraries, like NetSSL_OpenSSL, Crypto or Data/MySQL have dependencies to other libraries. Since the build script does not know where to find the necessary header files and import libraries, you have to either add the header file paths to the INCLUDE environment variable and the library path to the LIB environment variable, or you'll have to edit the buildwin.cmd script, where these environment variables can be set as well.

In order to run the test suite and the samples, the top-most bin directory containing the resulting shared libraries must be in the PATH environment variable.

 

 

Building On Unix/Linux/Mac OS X

 

For building on Unix platforms, the POCO C++ Libraries come with their own build system. The build system is based on GNU Make 3.80 (or newer), with the help from a few shell scripts. If you do not have GNU Make 3.80 (or newer) installed on your machine, you will need to download it from http://directory.fsf.org/devel/build/make.html and build and install it prior to building the POCO C++ Libraries.

You can check the version of GNU Make installed on your system with

 

$ gmake --version

 

or

 

$ make --version

 

Once you have GNU Make up and running, the rest is quite simple. To extract the sources and build all libraries, testsuites and samples, simply

 

$ gunzip poco-X.Y.tar.gz
$ tar -xf poco-X.Y.tar
$ cd poco-X.Y
$ ./configure
$ gmake -s

 

See the configure script source for a list of possible options. For starters, we recommend --no-tests and --no-samples, to reduce build times. On a multicore or multiprocessor machine, use parallel makes to speed up the build (make -j4).

Once you have successfully built POCO, you can install it to /usr/local (or another directory specified as parameter to configure --prefix=<path>):

 

$ sudo gmake -s install

 

You can omit certain components from the build. For example, you might want to omit Data/ODBC or Data/MySQL if you do not have the corresponding third-party libraries (iodbc or unixodbc, mysqlclient) installed on your system. To do this, use the --omit argument to configure:

 

$ ./configure --omit=Data/ODBC,Data/MySQL

 

IMPORTANT: Make sure that the path to the build directory does not contain symbolic links. Furthermore, on Mac OS X (or other systems with case insensitive filesystems), make sure that the characters in the path have the correct case. Otherwise you'll get an error saying "Current working directory not under $PROJECT_BASE.".

 

 

Building On QNX Neutrino

 

For QNX Neutrino, the Unix build system (see the instructions above) is used. You can use the build system to cross-compile for a target platform on a Solaris or Linux host. Unfortunately, the Cygwin-based Windows host environment has some major quirks that prevent the build system from working there. You can also use the build system on a self-hosted QNX system. The default build configuration for QNX (found in build/config/QNX) is for a self-hosted x86 platform. To specify another target, edit the CCVER setting in the build configuration file. For example, to compile for a PowerPC target, specify CCVER=3.3.1,gcc_ntoppcbe.

Service Pack 1 for QNX Neutrino 6.3 must be installed, otherwise compiling the Foundation library will fail due to a problem with the <list> header in the default (Dinkumware) C++ standard library.

When building on QNX, you might want to disable NetSSL_OpenSSL, Crypto and some Data connectors, unless you have the necessary third party components available:

 

$ ./configure --omit=NetSSL_OpenSSL,Crypto,Data/ODBC,Data/MySQL

 

 

 

Tutorials And Sample Code

 

Introductory documentation consisting of various documents and tutorials in the form of slide decks can be found at the POCO C++ Libraries Documentation]] page.

Sample applications demonstrating the various features of the POCO C++ Libraries are delivered with the source code. Every library's source code directory has a samples directory containing various sample applications.

When building the sample applications on platforms using the gmake-based build system, please make sure that the environment variable POCO_BASE contains the path to the POCO C++ Libraries source tree root directory.

 

 

Creating Your Own POCO-based Applications

 

The best way to create your first POCO-based application is by copying one of the sample projects and making the desired changes. Examine the project files and Makefiles to see what compiler options must be set for your specific platform.

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
22天前
|
JSON 程序员 数据格式
深入探索 “JSON for Modern C++“:安装、构建与应用
深入探索 “JSON for Modern C++“:安装、构建与应用
34 0
|
26天前
|
开发工具 C语言 C++
CMake构建大型C/C++项目:跨平台设计与高级应用(二)
CMake构建大型C/C++项目:跨平台设计与高级应用
40 0
|
1月前
|
存储 C++ 开发者
C++程序设计基础:构建稳固的编程基石
C++程序设计基础:构建稳固的编程基石
22 1
|
2月前
|
IDE 测试技术 开发工具
Poco新增对cocos c++游戏的支持
Poco新增对cocos c++游戏的支持
|
2月前
|
IDE Java 开发工具
【C/C++】C/C++编程——C++ 开发环境搭建
【C/C++】C/C++编程——C++ 开发环境搭建
57 0
|
3月前
|
存储 机器学习/深度学习 算法
使用 OpenCV4 和 C++ 构建计算机视觉项目:1~5
使用 OpenCV4 和 C++ 构建计算机视觉项目:1~5
67 0
|
3月前
|
关系型数据库 MySQL 开发工具
windows编译poco c++库
windows编译poco c++库
|
3月前
|
NoSQL Ubuntu 测试技术
GRPC C++开发环境搭建
GRPC C++开发环境搭建
47 0
|
5月前
|
存储 Cloud Native 编译器
C++ xmake构建
C++ xmake构建
|
1天前
|
数据采集 API 数据安全/隐私保护
畅游网络:构建C++网络爬虫的指南
本文介绍如何使用C++和cpprestsdk库构建高效网络爬虫,以抓取知乎热点信息。通过亿牛云爬虫代理服务解决IP限制问题,利用多线程提升数据采集速度。示例代码展示如何配置代理、发送HTTP请求及处理响应,实现多线程抓取。注意替换有效代理服务器参数,并处理异常。
畅游网络:构建C++网络爬虫的指南