Access the PostgreSQL database using Libpqxx (MinGW compiled libpqxx)

Source: Internet
Author: User
Tags postgresql win32

prepare before compiling

1. Installing mingw

installation MinGW (either directly installed MinGW or the others as Code :: blocks supplied with installed MinGW ), enter: gcc-v can display the version information like, my version is Mingw32 4.9.2 .

2.installationPostgreSQL

PostgreSQL address under each version: http://www.enterprisedb.com/products-services-training/pgdownload#windows

Note: To download the MinGW The compiler corresponds to the version, if it is Mingw32 please download 32bit Install the package or compile the package; mingw64 , please download 64bit Install the package or compile the package.

Why to install PostgreSQL ?

Libpqxxis based onLIBPQof theC + +implementation,libpqxx LIBPQ good encapsulation Developers can save a lot of coding time when they use it. If you feel that you c level is good, you can go directly to use LIBPQ

LIBPQ method of compiling: https://www.postgresql.org/docs/9.5/static/install-windows-libpq.html " PostgreSQL the documentation is really full. "

3.libpqxxcompiling  

Libpqxx : http://pqxx.org/download/software/libpqxx/

The downloaded version is:libpqxx-4.0.1

After extracting the downloaded file, go to directory libpqxx-4.0.1\win32, copy the common-sample file, modify the file name to Common.

Open The commonand modify the following (' # ' for the shield symbol):

#PGSQLSRC = "C:\Sources\postgresql-9.1.1\src"

Pgsqlsrc= "C:\Program Files (x86) \postgresql\9.5"

#LIBPQINC =$ (PGSQLSRC) \INTERFACES\LIBPQ

libpqinc=$ (PGSQLSRC) \include

#LIBPQPATH =$ (PGSQLSRC) \interfaces\libpq\release
#LIBPQDLL =libpq.dll
#LIBPQLIB =libpqdll.lib

libpqpath=$ (PGSQLSRC) \lib
Libpqdll=libpq.dll
Libpqlib=libpq.lib

#LIBPQDPATH =$ (PGSQLSRC) \interfaces\libpq\debug
#LIBPQDDLL =libpqd.dll
#LIBPQDLIB =libpqddll.lib

libpqdpath=$ (PGSQLSRC) \lib
Libpqddll=libpq.dll
Libpqdlib=libpq.lib

Save after the modification is complete.

will be libpqxx-4.0.1\config\sample-headers\compiler\mingw-3.4\pqxx\ All header files in the directory are copied to include\pqxx under the catalogue ;

will be libpqxx-4.0.1\config\sample-headers\libpq\9.0\pqxx\ All header files in the directory are copied to Include\pqxx directory.

Switch to libpqxx-4.0.1\ directory, run the command: mingw32-make-f Win32\mingw.mak All .

If you follow the above action, you should complete Libpqxx compile.

installation PostgreSQL Be sure to install the version corresponding to the compiler, otherwise it will be reported at compile time . DLL Reference Error

Access the PostgreSQL database using Libpqxx (MinGW compiled libpqxx)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.