Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Use libpq under Ubuntu 14.04     - Installation on the way to the root source Ubuntu Server 14.04 LTS version Odoo8.0 (Server)

- SQLite database commonly used sentences and visualization tools on MAC MeasSQLlite use (Database)

- Install the system cleaning software under Linux: BleachBit 1.4 (Linux)

- Firewall Configuration Red Hat Enterprise Linux 4 (Linux)

- How do you access Dropbox Linux command line (Linux)

- Android to determine whether the device to open WIFI, GPRS data connection (Programming)

- Linux operating system set up to effectively prevent ARP attacks (Linux)

- Yii2 Advanced Version Copy New Project Problem Solved (Programming)

- How to configure security management services under Linux (Linux)

- MySQL 5.6 Open full query log (Database)

- CentOS 6.5_x64 install Oracle 11g R2 (Database)

- Character Encoding notes: ASCII, Unicode and UTF-8 (Linux)

- Configuration OpenOCD + FT2232 under Ubuntu (Linux)

- Memcached distributed caching (Server)

- MySQL query performance comparison of a single truth (Database)

- You know the difference between URL, URI and URN among you (Linux)

- Install the latest Eclipse IDE in Ubuntu (Linux)

- Secondary exponential smoothing prediction method implemented in Python (Programming)

- Oracle rebuild index script (Database)

- How to configure FirewallD in RHEL / CentOS 7 and Fedora in (Linux)

 
         
  Use libpq under Ubuntu 14.04
     
  Add Date : 2018-11-21      
         
       
         
  The Postgres c ++ interfaces already changed libpqxx, libpq ++ in Ubuntu 14.04 can not compile under, in order to use libpq ++ needs some modification.

First, download libpq ++ - 4.0.tar.gz and unzip

Second, enter libpq ++ - 4.0 directory

Third, open the Makefile

Modify POSTGRES_HOME = / opt / PostgreSQL / 9.3 (your postgresql install directory)

Modify CXXOPTS = -fPIC -DHAVE_NAMESPACE_STD -DHAVE_CXX_STRING_HEADER -DDLLIMPORT = ""

64 system must add -fPIC

Fourth, open pgdatabase.cc

Stdlib.h at the top contains the file name (or the atoi function can not find)

Five, make & sudo make install

Six, / etc / ld.so.conf.d / or LD_LIBRARY_PATH plus library search path

And execute sudo ldconfig -v

Or at compile time plus -Wl, -rpath = / opt / PostgreSQL / 9.3 / lib

Seven test

test.cpp (the mydb, mytable tinkering)

#include < stdlib.h>
#include < iostream>
#include < libpq ++. h>
using namespace std;
int main () {
char query_string [256] = "SELECT * FROM mytable;";
PgDatabase data ( "dbname = mydb");
if (data.ConnectionBad ()) {
cout << "connected failed" << endl;
cout << "Error is" << data.ErrorMessage () << endl;
exit (1);
}
if (! data.ExecTuplesOk (query_string)) {
cout << "Query Failed!" << endl;
exit (1);
}
for (int k = 0; k
cout << data.FieldName (k);
cout << "";
}
cout << endl;
for (int i = 0; i for (int k = 0; k
cout << data.GetValue (i, k);
cout << "|";
}
cout << endl;
}
return 0;
}

g ++ test.cpp -o test -fPIC -DHAVE_NAMESPACE_STD -DHAVE_CXX_STRING_HEADER -DDLLIMPORT = "" -I /opt/PostgreSQL/9.3/include -L / opt / PostgreSQL / 9.3 / lib -lpq ++ -lpq
./test
     
         
       
         
  More:      
 
- Server Security Analysis attack on Linux (Linux)
- Terminal fun: 6 interesting Linux command-line tools (Linux)
- Internal class broadcasting needs public and static (Programming)
- Hadoop1.2.1 plug compilation (Server)
- How to fix fatal error: security / pam_modules.h: No such file or directory (Linux)
- Linux compression and decompression command (Linux)
- APR for Tomcat installation under Linux (Server)
- nginx.conf Optimization (Server)
- To install and use Docker under linux (Server)
- Spring next ActiveMQ combat (Programming)
- Linux regex sed detailing (Linux)
- Installation on the way to the root source Ubuntu Server 14.04 LTS version Odoo8.0 (Server)
- Linux compiler of GCC (Linux)
- Archlinux installation tutorial (Linux)
- Under CentOS yum install Nginx smooth switch mounted to Tengine (Server)
- Installation and Configuration ISC DHCP server on Debian Linux (Server)
- CentOS 6.5 install VNC-Server (Linux)
- Hibernate Search 5.5 in the search results sorted (Linux)
- Log in CentOS 6.5 Multi-user setting VNC (Server)
- Use PDFBox parse PDF file (Linux)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.