2
votes

I've very simple example, and can't correctly build it, I was using next arguments:

g++ -lpq -libpqxx -Wall -o "pg" "pg.cpp" (in dir: /home/user) /usr/lib/gcc/i586-suse-linux/4.5/../../../../i586-suse-linux/bin/ld: cannot find -lpq collect2: ld returned 1 exit status

or

returned 1 exit status g++ -libpqxx -Wall -o "pg" "pg.cpp" (in dir: /home/user) /usr/lib/gcc/i586-suse-linux/4.5/../../../../i586-suse-linux/bin/ld: cannot find -libpqxx collect2: ld

but everywere had error. libpqxx succ installed

@lisuse-home:~> locate libpqxx | grep /lib/ /usr/lib/libpqxx-3.1.so /usr/lib/libpqxx.la /usr/lib/libpqxx.so /usr/lib/pkgconfig/libpqxx.pc

2
Take a look at this: postgresql.org/docs/9.2/static/app-pgconfig.html . It can help you find include/paths/library names. - coelhudo

2 Answers

3
votes
g++ filename.cpp -o target -lpqxx

-lpqxx should take care of -lpq. If for some reason it does not find pq, find pq and put it in the same directory as pqxx.

0
votes

compiling g++ -libpqxx-3.1 -Wall -c "%f"

building g++ -Wall -o "%e" /usr/lib/libpqxx-3.1.so "%f"