Thread
-
libpq++ linking
Vazsonyi Peter[ke] <neko@kornel.szif.hu> — 1998-01-22T17:51:01Z
Hello! I try to use libpq++ (linux: redhat4.2, postgresql-(devel)?-6.2 GNU c) And i have problem with linking: [root@3dom neko]# g++ -I/usr/include/postgres/ -lpq++ -o a a.cc /tmp/cca032541.o: In function ain': /tmp/cca032541.o(.text+0x22): undefined reference to gConnection::Exec(char const *)' ... And more like this. But where is this famous exec? [root@3dom neko]# nm -C /usr/lib/libpq++.a | grep 'Exec(char' 00000348 T PgConnection::Exec(char const *) U PgConnection::Exec(char const *) All right. In libpq++. And I use this lib? [root@3dom neko]# mv /usr/lib/libpq++.a . [root@3dom neko]# g++ -I/usr/include/postgres/ -lpq -lpq++ -o e e.cc ld: cannot open -lpq++: No such file or directory Yes. We were use before this. And include-s is too works. My first program: -------- x -------- #include <postgres/libpq++.h> #ifndef PGDATABASE_H main(){;}; #else // PGDATABASE_H #include <iostream.h> main(){ ExecStatusType XStat; PgDatabase conn("tval"); XStat=conn.Exec("select oid from szak order by oid ;"); for (int i=0,max=conn.Tuples();max>i;i++) { cout << conn.GetValue(i,0) << endl; } } #endif // PGDATABASE_H -------- x -------- I mean, i try all what i can. But somewhere i must done a mistake. BUT where?! Please help me... sprintf ("`-''-/").___..--''"`-._ Error In ("%|s", `6_ 6 ) `-. ( ).`-.__.`) Loading Object "Petike" (_Y_.)' ._ ) `._ `. ``-..-' line:3 /* Neko */ _..`--'_..-_/ /--'_.' ,' Before /*Neko*/ ); (il),-'' (li),' ((!.-' -
Re: [HACKERS] libpq++ linking
Maarten Boekhold <maartenb@dutepp0.et.tudelft.nl> — 1998-01-22T20:22:20Z
On Thu, 22 Jan 1998, Vazsonyi Peter[ke] wrote: > Hello! > > I try to use libpq++ (linux: redhat4.2, postgresql-(devel)?-6.2 GNU c) > And i have problem with linking: > > [root@3dom neko]# g++ -I/usr/include/postgres/ -lpq++ -o a a.cc > /tmp/cca032541.o: In function ain': > /tmp/cca032541.o(.text+0x22): undefined reference to gConnection::Exec(char > const *)' > ... > And more like this. But where is this famous exec? > > [root@3dom neko]# nm -C /usr/lib/libpq++.a | grep 'Exec(char' > 00000348 T PgConnection::Exec(char const *) > U PgConnection::Exec(char const *) > > All right. In libpq++. > And I use this lib? > [root@3dom neko]# mv /usr/lib/libpq++.a . > [root@3dom neko]# g++ -I/usr/include/postgres/ -lpq -lpq++ -o e e.cc > ld: cannot open -lpq++: No such file or directory > Yes. We were use before this. Try putting the -lpq++ *after* your input files, ie. last on the line. Maarten _____________________________________________________________________________ | Maarten Boekhold, Faculty of Electrical Engineering TU Delft, NL | | Computer Architecture and Digital Technique section | | M.Boekhold@et.tudelft.nl | -----------------------------------------------------------------------------