[Libpqxx-general] what's wrong with my basic program?
Roland Bock
rbock at eudoxos.de
Wed Sep 9 10:19:00 UTC 2009
Caleb Cushing wrote:
> #include <iostream>
> #include <pqxx/pqxx>
>
> using namespace std;
> using namespace pqxx;
>
> int main()
> {
> try {
> connection Conn("user=xenoterracide dbname=xenoterracide");
> cout << "Connected to " << Conn.dbname() << endl;
> }
> catch (const exception &e) {
> cerr << e.what() << endl;
> return 1;
> }
> return 0;
> }
>
> it fails to link and I'm not sure why. I'm running archlinux
>
> /tmp/cclde6TU.o: In function `main':
> dbtest.cpp:(.text+0x2d): undefined reference to
> `pqxx::connection_base::dbname()'
I guess you have not told the linker (or buildsystem) to use libpqxx?
Something like -lpqxx should help on the commandline.
Regards,
Roland
More information about the Libpqxx-general
mailing list