[Libpqxx-general] Creating a connection object

Richard B. Kreckel kreckel at ginac.de
Thu Jun 12 20:47:43 UTC 2008


Hi!

Vincent Predoehl wrote:
> I'm want to use libpqxx integration in my app.  The tutorial says to 
> create a connection using:
> 
> connection Conn("dbname=test");
> 
> The correct header to use appears to be #include <pqxx/connection>, but 
> I get this compile error:
> 
> /usr/local/include/pqxx/basic_connection.hxx:45: error: redefinition of 
> 'class pqxx::basic_connection<CONNECTPOLICY>'
> /usr/local/include/pqxx/basic_connection.hxx:47: error: previous 
> definition of 'class pqxx::basic_connection<CONNECTPOLICY>'

This is precisely the error message produced by g++ when #including 
<pqxx/basic_connection.hxx> twice, or in addition to <pqxx/connection>. 
Please check the headers included by your app.

(Maybe, *every* public header file should have an include guard.)

Bye
   -richy.
-- 
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>


More information about the Libpqxx-general mailing list