Обсуждение: [Linker Error] Unresolved external
Hi all, As a novice I installed PostgreSQL 7.2.1 on Win32 and works, Borland C++Builder Enterprise Suite 5.0 (build 12.34) what works too. I decided to combine these two programs and develop a simple GUI app to display datas queried from PostgreSQL. I did make the following changes in the project's settings: Project->Properties->Directories->Include path += C:\Program Files\PostgreSQL\7\include Project->Properties->Directories->Librariy path += C:\Program Files\PostgreSQL\7\lib (I aded these lines to the project paths). Within a brand new BCB project I typed in the simpliest code: #include <libpq-fe.h> char *pghost, *pgport, *pgoptions, *pgtty; char *dbName; int nFields, i, j; PGconn *conn; PGresult *res; pghost = NULL; /* host name of the backend server */ pgport = NULL; /* port of the backend server */ pgoptions = NULL; /* special options to start up the backend * server */ pgtty = NULL; /* debugging tty for the backend server */ dbName = "template1"; /* make a connection to the database */ conn = PQsetdb(pghost, pgport, pgoptions, pgtty, dbName); res = PQexec(conn, "BEGIN"); PQclear(res); res = PQexec(conn, "DECLARE mycursor CURSOR FOR SELECT * FROM pg_database"); PQclear(res); res = PQexec(conn, "FETCH ALL in mycursor"); nFields = PQnfields(res); for (i = 0; i < nFields; i++) printf("%-15s", PQfname(res, i)); printf("\n\n"); /* next, print out the rows */ for (i = 0; i < PQntuples(res); i++) { for (j = 0; j < nFields; j++) printf("%-15s", PQgetvalue(res, i, j)); printf("\n"); } PQclear(res); res = PQexec(conn, "CLOSE mycursor"); PQclear(res); /* commit the transaction */ res = PQexec(conn, "COMMIT"); PQclear(res); /* close the connection to the database and cleanup */ PQfinish(conn); When I run the app I got these errors: [Linker Error] Unresolved external '_PQconnectdb' referenced from C:\PROGRAM FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ [Linker Error] Unresolved external '_PQnfields' referenced from C:\PROGRAM FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ [Linker Error] Unresolved external '_PQexec' referenced from C:\PROGRAM FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ [Linker Error] Unresolved external '_PQclear' referenced from C:\PROGRAM FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ [Linker Error] Unresolved external '_PQfinish' referenced from C:\PROGRAM FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ What is wrong? I supose that I miss something to configure. Laszlo Graf
You need to link with libpqdll.lib. So far you are just specifying a directory to look for the .lib in - not actually tellingit to do the link. I have no idea how to do that in Borland C++, though. In MSVC you just add the lib file to yourproject. (Also, beware that PostgreSQL 7.2.1 is *very* old. I'd strongly suggest you look at something newer. For win32, you can gowith either 7.4 on cygwin or 8.0 release candidate on native win32) //Magnus > -----Original Message----- > From: Graf László [mailto:graf.laszlo@axis.hu] > Sent: Monday, December 06, 2004 10:20 AM > To: pgsql-hackers-win32@postgresql.org > Subject: [pgsql-hackers-win32] [Linker Error] Unresolved external > > Hi all, > > As a novice I installed PostgreSQL 7.2.1 on Win32 and works, > Borland C++Builder Enterprise Suite 5.0 (build 12.34) what works too. > > I decided to combine these two programs and develop a simple > GUI app to display datas queried from PostgreSQL. I did make > the following changes in the project's settings: > > Project->Properties->Directories->Include path += C:\Program > Project->Properties->Directories->Files\PostgreSQL\7\include Librariy > Project->Properties->Directories->path += C:\Program > Project->Properties->Directories->Files\PostgreSQL\7\lib > > (I aded these lines to the project paths). > > Within a brand new BCB project I typed in the simpliest code: > > > #include <libpq-fe.h> > char *pghost, *pgport, *pgoptions, *pgtty; > char *dbName; > int nFields, i, j; > PGconn *conn; > PGresult *res; > > pghost = NULL; /* host name of the backend server */ > pgport = NULL; /* port of the backend server */ > pgoptions = NULL; /* special options to start up the backend > * server */ > pgtty = NULL; /* debugging tty for the backend server */ > dbName = "template1"; > > /* make a connection to the database */ > conn = PQsetdb(pghost, pgport, pgoptions, pgtty, dbName); > > res = PQexec(conn, "BEGIN"); > PQclear(res); > > res = PQexec(conn, "DECLARE mycursor CURSOR FOR SELECT * FROM > pg_database"); PQclear(res); res = PQexec(conn, "FETCH ALL in > mycursor"); nFields = PQnfields(res); for (i = 0; i < nFields; i++) > printf("%-15s", PQfname(res, i)); > printf("\n\n"); > > /* next, print out the rows */ > for (i = 0; i < PQntuples(res); i++) > { > for (j = 0; j < nFields; j++) > printf("%-15s", PQgetvalue(res, i, j)); > printf("\n"); > } > PQclear(res); > > res = PQexec(conn, "CLOSE mycursor"); > PQclear(res); > > /* commit the transaction */ > res = PQexec(conn, "COMMIT"); > PQclear(res); > > /* close the connection to the database and cleanup */ PQfinish(conn); > > When I run the app I got these errors: > > [Linker Error] Unresolved external '_PQconnectdb' > referenced from C:\PROGRAM > FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ > [Linker Error] Unresolved external '_PQnfields' > referenced from C:\PROGRAM > FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ > [Linker Error] Unresolved external '_PQexec' > referenced from C:\PROGRAM > FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ > [Linker Error] Unresolved external '_PQclear' > referenced from C:\PROGRAM > FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ > [Linker Error] Unresolved external '_PQfinish' > referenced from C:\PROGRAM > FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ > > What is wrong? I supose that I miss something to configure. > > Laszlo Graf > > ---------------------------(end of > broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faqs/FAQ.html > >
I got the 8.0 release but it do not contain include files only dlls in the lib forder. Magnus Hagander wrote: > You need to link with libpqdll.lib. So far you are just specifying a directory to look for the .lib in - not actuallytelling it to do the link. I have no idea how to do that in Borland C++, though. In MSVC you just add the lib fileto your project. > > (Also, beware that PostgreSQL 7.2.1 is *very* old. I'd strongly suggest you look at something newer. For win32, you cango with either 7.4 on cygwin or 8.0 release candidate on native win32) > > //Magnus > > >>-----Original Message----- >>From: Graf László [mailto:graf.laszlo@axis.hu] >>Sent: Monday, December 06, 2004 10:20 AM >>To: pgsql-hackers-win32@postgresql.org >>Subject: [pgsql-hackers-win32] [Linker Error] Unresolved external >> >>Hi all, >> >>As a novice I installed PostgreSQL 7.2.1 on Win32 and works, >>Borland C++Builder Enterprise Suite 5.0 (build 12.34) what works too. >> >>I decided to combine these two programs and develop a simple >>GUI app to display datas queried from PostgreSQL. I did make >>the following changes in the project's settings: >> >>Project->Properties->Directories->Include path += C:\Program >>Project->Properties->Directories->Files\PostgreSQL\7\include Librariy >>Project->Properties->Directories->path += C:\Program >>Project->Properties->Directories->Files\PostgreSQL\7\lib >> >>(I aded these lines to the project paths). >> >>Within a brand new BCB project I typed in the simpliest code: >> >> >>#include <libpq-fe.h> >>char *pghost, *pgport, *pgoptions, *pgtty; >>char *dbName; >>int nFields, i, j; >>PGconn *conn; >>PGresult *res; >> >>pghost = NULL; /* host name of the backend server */ >>pgport = NULL; /* port of the backend server */ >>pgoptions = NULL; /* special options to start up the backend >> * server */ >>pgtty = NULL; /* debugging tty for the backend server */ >>dbName = "template1"; >> >>/* make a connection to the database */ >>conn = PQsetdb(pghost, pgport, pgoptions, pgtty, dbName); >> >>res = PQexec(conn, "BEGIN"); >>PQclear(res); >> >>res = PQexec(conn, "DECLARE mycursor CURSOR FOR SELECT * FROM >>pg_database"); PQclear(res); res = PQexec(conn, "FETCH ALL in >>mycursor"); nFields = PQnfields(res); for (i = 0; i < nFields; i++) >> printf("%-15s", PQfname(res, i)); >>printf("\n\n"); >> >>/* next, print out the rows */ >>for (i = 0; i < PQntuples(res); i++) >>{ >> for (j = 0; j < nFields; j++) >> printf("%-15s", PQgetvalue(res, i, j)); >> printf("\n"); >>} >>PQclear(res); >> >>res = PQexec(conn, "CLOSE mycursor"); >>PQclear(res); >> >>/* commit the transaction */ >>res = PQexec(conn, "COMMIT"); >>PQclear(res); >> >>/* close the connection to the database and cleanup */ PQfinish(conn); >> >>When I run the app I got these errors: >> >>[Linker Error] Unresolved external '_PQconnectdb' >> referenced from C:\PROGRAM >>FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ >>[Linker Error] Unresolved external '_PQnfields' >> referenced from C:\PROGRAM >>FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ >>[Linker Error] Unresolved external '_PQexec' >> referenced from C:\PROGRAM >>FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ >>[Linker Error] Unresolved external '_PQclear' >> referenced from C:\PROGRAM >>FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ >>[Linker Error] Unresolved external '_PQfinish' >> referenced from C:\PROGRAM >>FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ >> >>What is wrong? I supose that I miss something to configure. >> >>Laszlo Graf >> >>---------------------------(end of >>broadcast)--------------------------- >>TIP 5: Have you checked our extensive FAQ? >> >> http://www.postgresql.org/docs/faqs/FAQ.html >> >> -- Graf László - bitfaragó http://grafl.port5.com/
It should contain the include files, but you need to specifically enable that feature for installation (they're not installedby default, IIRC). //Magnus > -----Original Message----- > From: Graf László [mailto:graf.laszlo@axis.hu] > Sent: Monday, December 06, 2004 1:01 PM > To: Magnus Hagander; pgsql-hackers-win32@postgresql.org > Subject: Re: [pgsql-hackers-win32] [Linker Error] Unresolved external > > I got the 8.0 release but it do not contain include files > only dlls in the lib forder. > > Magnus Hagander wrote: > > You need to link with libpqdll.lib. So far you are just > specifying a directory to look for the .lib in - not > actually telling it to do the link. I have no idea how to do > that in Borland C++, though. In MSVC you just add the lib > file to your project. > > > > (Also, beware that PostgreSQL 7.2.1 is *very* old. I'd strongly > > suggest you look at something newer. For win32, you can go > with either > > 7.4 on cygwin or 8.0 release candidate on native win32) > > > > //Magnus > > > > > >>-----Original Message----- > >>From: Graf László [mailto:graf.laszlo@axis.hu] > >>Sent: Monday, December 06, 2004 10:20 AM > >>To: pgsql-hackers-win32@postgresql.org > >>Subject: [pgsql-hackers-win32] [Linker Error] Unresolved external > >> > >>Hi all, > >> > >>As a novice I installed PostgreSQL 7.2.1 on Win32 and > works, Borland > >>C++Builder Enterprise Suite 5.0 (build 12.34) what works too. > >> > >>I decided to combine these two programs and develop a > simple GUI app > >>to display datas queried from PostgreSQL. I did make the following > >>changes in the project's settings: > >> > >>Project->Properties->Directories->Include path += C:\Program > >>Project->Properties->Directories->Files\PostgreSQL\7\include > Librariy > >>Project->Properties->Directories->path += C:\Program > >>Project->Properties->Directories->Files\PostgreSQL\7\lib > >> > >>(I aded these lines to the project paths). > >> > >>Within a brand new BCB project I typed in the simpliest code: > >> > >> > >>#include <libpq-fe.h> > >>char *pghost, *pgport, *pgoptions, *pgtty; > >>char *dbName; > >>int nFields, i, j; > >>PGconn *conn; > >>PGresult *res; > >> > >>pghost = NULL; /* host name of the backend server */ > >>pgport = NULL; /* port of the backend server */ > >>pgoptions = NULL; /* special options to start up > the backend > >> * server */ > >>pgtty = NULL; /* debugging tty for the > backend server */ > >>dbName = "template1"; > >> > >>/* make a connection to the database */ conn = > PQsetdb(pghost, pgport, > >>pgoptions, pgtty, dbName); > >> > >>res = PQexec(conn, "BEGIN"); > >>PQclear(res); > >> > >>res = PQexec(conn, "DECLARE mycursor CURSOR FOR SELECT * FROM > >>pg_database"); PQclear(res); res = PQexec(conn, "FETCH ALL in > >>mycursor"); nFields = PQnfields(res); for (i = 0; i < nFields; i++) > >> printf("%-15s", PQfname(res, i)); printf("\n\n"); > >> > >>/* next, print out the rows */ > >>for (i = 0; i < PQntuples(res); i++) > >>{ > >> for (j = 0; j < nFields; j++) > >> printf("%-15s", PQgetvalue(res, i, j)); > >> printf("\n"); > >>} > >>PQclear(res); > >> > >>res = PQexec(conn, "CLOSE mycursor"); > >>PQclear(res); > >> > >>/* commit the transaction */ > >>res = PQexec(conn, "COMMIT"); > >>PQclear(res); > >> > >>/* close the connection to the database and cleanup */ > PQfinish(conn); > >> > >>When I run the app I got these errors: > >> > >>[Linker Error] Unresolved external '_PQconnectdb' > >> referenced from C:\PROGRAM > >>FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ > >>[Linker Error] Unresolved external '_PQnfields' > >> referenced from C:\PROGRAM > >>FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ > >>[Linker Error] Unresolved external '_PQexec' > >> referenced from C:\PROGRAM > >>FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ > >>[Linker Error] Unresolved external '_PQclear' > >> referenced from C:\PROGRAM > >>FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ > >>[Linker Error] Unresolved external '_PQfinish' > >> referenced from C:\PROGRAM > >>FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ > >> > >>What is wrong? I supose that I miss something to configure. > >> > >>Laszlo Graf > >> > >>---------------------------(end of > >>broadcast)--------------------------- > >>TIP 5: Have you checked our extensive FAQ? > >> > >> http://www.postgresql.org/docs/faqs/FAQ.html > >> > >> > > -- > Graf László - bitfaragó > http://grafl.port5.com/ > >
OK I got it. I had to reinstall the 8 release and change some install settings. So now I have the include and lib folders. But I got a new error message now. It say that I can not install and start the service because the user grafl is member of admin group. How can I start it remaining in the admin group? Magnus Hagander wrote: > It should contain the include files, but you need to specifically enable that feature for installation (they're not installedby default, IIRC). > > //Magnus > > >>-----Original Message----- >>From: Graf László [mailto:graf.laszlo@axis.hu] >>Sent: Monday, December 06, 2004 1:01 PM >>To: Magnus Hagander; pgsql-hackers-win32@postgresql.org >>Subject: Re: [pgsql-hackers-win32] [Linker Error] Unresolved external >> >>I got the 8.0 release but it do not contain include files >>only dlls in the lib forder. >> >>Magnus Hagander wrote: >> >>>You need to link with libpqdll.lib. So far you are just >> >>specifying a directory to look for the .lib in - not >>actually telling it to do the link. I have no idea how to do >>that in Borland C++, though. In MSVC you just add the lib >>file to your project. >> >>>(Also, beware that PostgreSQL 7.2.1 is *very* old. I'd strongly >>>suggest you look at something newer. For win32, you can go >> >>with either >> >>>7.4 on cygwin or 8.0 release candidate on native win32) >>> >>>//Magnus >>> >>> >>> >>>>-----Original Message----- >>>>From: Graf László [mailto:graf.laszlo@axis.hu] >>>>Sent: Monday, December 06, 2004 10:20 AM >>>>To: pgsql-hackers-win32@postgresql.org >>>>Subject: [pgsql-hackers-win32] [Linker Error] Unresolved external >>>> >>>>Hi all, >>>> >>>>As a novice I installed PostgreSQL 7.2.1 on Win32 and >> >>works, Borland >> >>>>C++Builder Enterprise Suite 5.0 (build 12.34) what works too. >>>> >>>>I decided to combine these two programs and develop a >> >>simple GUI app >> >>>>to display datas queried from PostgreSQL. I did make the following >>>>changes in the project's settings: >>>> >>>>Project->Properties->Directories->Include path += C:\Program >>>>Project->Properties->Directories->Files\PostgreSQL\7\include >> >> Librariy >> >>>>Project->Properties->Directories->path += C:\Program >>>>Project->Properties->Directories->Files\PostgreSQL\7\lib >>>> >>>>(I aded these lines to the project paths). >>>> >>>>Within a brand new BCB project I typed in the simpliest code: >>>> >>>> >>>>#include <libpq-fe.h> >>>>char *pghost, *pgport, *pgoptions, *pgtty; >>>>char *dbName; >>>>int nFields, i, j; >>>>PGconn *conn; >>>>PGresult *res; >>>> >>>>pghost = NULL; /* host name of the backend server */ >>>>pgport = NULL; /* port of the backend server */ >>>>pgoptions = NULL; /* special options to start up >> >>the backend >> >>>> * server */ >>>>pgtty = NULL; /* debugging tty for the >> >>backend server */ >> >>>>dbName = "template1"; >>>> >>>>/* make a connection to the database */ conn = >> >>PQsetdb(pghost, pgport, >> >>>>pgoptions, pgtty, dbName); >>>> >>>>res = PQexec(conn, "BEGIN"); >>>>PQclear(res); >>>> >>>>res = PQexec(conn, "DECLARE mycursor CURSOR FOR SELECT * FROM >>>>pg_database"); PQclear(res); res = PQexec(conn, "FETCH ALL in >>>>mycursor"); nFields = PQnfields(res); for (i = 0; i < nFields; i++) >>>> printf("%-15s", PQfname(res, i)); printf("\n\n"); >>>> >>>>/* next, print out the rows */ >>>>for (i = 0; i < PQntuples(res); i++) >>>>{ >>>> for (j = 0; j < nFields; j++) >>>> printf("%-15s", PQgetvalue(res, i, j)); >>>> printf("\n"); >>>>} >>>>PQclear(res); >>>> >>>>res = PQexec(conn, "CLOSE mycursor"); >>>>PQclear(res); >>>> >>>>/* commit the transaction */ >>>>res = PQexec(conn, "COMMIT"); >>>>PQclear(res); >>>> >>>>/* close the connection to the database and cleanup */ >> >>PQfinish(conn); >> >>>>When I run the app I got these errors: >>>> >>>>[Linker Error] Unresolved external '_PQconnectdb' >>>> referenced from C:\PROGRAM >>>>FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ >>>>[Linker Error] Unresolved external '_PQnfields' >>>> referenced from C:\PROGRAM >>>>FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ >>>>[Linker Error] Unresolved external '_PQexec' >>>> referenced from C:\PROGRAM >>>>FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ >>>>[Linker Error] Unresolved external '_PQclear' >>>> referenced from C:\PROGRAM >>>>FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ >>>>[Linker Error] Unresolved external '_PQfinish' >>>> referenced from C:\PROGRAM >>>>FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ >>>> >>>>What is wrong? I supose that I miss something to configure. >>>> >>>>Laszlo Graf >>>> >>>>---------------------------(end of >>>>broadcast)--------------------------- >>>>TIP 5: Have you checked our extensive FAQ? >>>> >>>> http://www.postgresql.org/docs/faqs/FAQ.html >>>> >>>> >> >>-- >>Graf László - bitfaragó >>http://grafl.port5.com/ >> >> -- Graf László - bitfaragó http://grafl.port5.com/
The postgresql *service* account *must not* be in the administrator group. There is no way around that. You should use aseparate account for the postgresql service, and this account should be as limited as possible. //Magnus > -----Original Message----- > From: Graf László [mailto:graf.laszlo@axis.hu] > Sent: Monday, December 06, 2004 1:32 PM > To: Magnus Hagander; pgsql-hackers-win32@postgresql.org > Subject: Re: [pgsql-hackers-win32] [Linker Error] Unresolved external > > OK I got it. > I had to reinstall the 8 release and change some install settings. > So now I have the include and lib folders. > But I got a new error message now. It say that I can not > install and start the service because the user grafl is > member of admin group. > > How can I start it remaining in the admin group? > > Magnus Hagander wrote: > > It should contain the include files, but you need to > specifically enable that feature for installation (they're > not installed by default, IIRC). > > > > //Magnus > > > > > >>-----Original Message----- > >>From: Graf László [mailto:graf.laszlo@axis.hu] > >>Sent: Monday, December 06, 2004 1:01 PM > >>To: Magnus Hagander; pgsql-hackers-win32@postgresql.org > >>Subject: Re: [pgsql-hackers-win32] [Linker Error] > Unresolved external > >> > >>I got the 8.0 release but it do not contain include files > only dlls in > >>the lib forder. > >> > >>Magnus Hagander wrote: > >> > >>>You need to link with libpqdll.lib. So far you are just > >> > >>specifying a directory to look for the .lib in - not > actually telling > >>it to do the link. I have no idea how to do that in Borland C++, > >>though. In MSVC you just add the lib file to your project. > >> > >>>(Also, beware that PostgreSQL 7.2.1 is *very* old. I'd strongly > >>>suggest you look at something newer. For win32, you can go > >> > >>with either > >> > >>>7.4 on cygwin or 8.0 release candidate on native win32) > >>> > >>>//Magnus > >>> > >>> > >>> > >>>>-----Original Message----- > >>>>From: Graf László [mailto:graf.laszlo@axis.hu] > >>>>Sent: Monday, December 06, 2004 10:20 AM > >>>>To: pgsql-hackers-win32@postgresql.org > >>>>Subject: [pgsql-hackers-win32] [Linker Error] Unresolved external > >>>> > >>>>Hi all, > >>>> > >>>>As a novice I installed PostgreSQL 7.2.1 on Win32 and > >> > >>works, Borland > >> > >>>>C++Builder Enterprise Suite 5.0 (build 12.34) what works too. > >>>> > >>>>I decided to combine these two programs and develop a > >> > >>simple GUI app > >> > >>>>to display datas queried from PostgreSQL. I did make the > following > >>>>changes in the project's settings: > >>>> > >>>>Project->Properties->Directories->Include path += C:\Program > >>>>Project->Properties->Directories->Files\PostgreSQL\7\include > >> > >> Librariy > >> > >>>>Project->Properties->Directories->path += C:\Program > >>>>Project->Properties->Directories->Files\PostgreSQL\7\lib > >>>> > >>>>(I aded these lines to the project paths). > >>>> > >>>>Within a brand new BCB project I typed in the simpliest code: > >>>> > >>>> > >>>>#include <libpq-fe.h> > >>>>char *pghost, *pgport, *pgoptions, *pgtty; > >>>>char *dbName; > >>>>int nFields, i, j; > >>>>PGconn *conn; > >>>>PGresult *res; > >>>> > >>>>pghost = NULL; /* host name of the backend server */ > >>>>pgport = NULL; /* port of the backend server */ > >>>>pgoptions = NULL; /* special options to start up > >> > >>the backend > >> > >>>> * server */ > >>>>pgtty = NULL; /* debugging tty for the > >> > >>backend server */ > >> > >>>>dbName = "template1"; > >>>> > >>>>/* make a connection to the database */ conn = > >> > >>PQsetdb(pghost, pgport, > >> > >>>>pgoptions, pgtty, dbName); > >>>> > >>>>res = PQexec(conn, "BEGIN"); > >>>>PQclear(res); > >>>> > >>>>res = PQexec(conn, "DECLARE mycursor CURSOR FOR SELECT * FROM > >>>>pg_database"); PQclear(res); res = PQexec(conn, "FETCH ALL in > >>>>mycursor"); nFields = PQnfields(res); for (i = 0; i < > nFields; i++) > >>>> printf("%-15s", PQfname(res, i)); printf("\n\n"); > >>>> > >>>>/* next, print out the rows */ > >>>>for (i = 0; i < PQntuples(res); i++) { > >>>> for (j = 0; j < nFields; j++) > >>>> printf("%-15s", PQgetvalue(res, i, j)); > >>>> printf("\n"); > >>>>} > >>>>PQclear(res); > >>>> > >>>>res = PQexec(conn, "CLOSE mycursor"); PQclear(res); > >>>> > >>>>/* commit the transaction */ > >>>>res = PQexec(conn, "COMMIT"); > >>>>PQclear(res); > >>>> > >>>>/* close the connection to the database and cleanup */ > >> > >>PQfinish(conn); > >> > >>>>When I run the app I got these errors: > >>>> > >>>>[Linker Error] Unresolved external '_PQconnectdb' > >>>> referenced from C:\PROGRAM > >>>>FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ > >>>>[Linker Error] Unresolved external '_PQnfields' > >>>> referenced from C:\PROGRAM > >>>>FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ > >>>>[Linker Error] Unresolved external '_PQexec' > >>>> referenced from C:\PROGRAM > >>>>FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ > >>>>[Linker Error] Unresolved external '_PQclear' > >>>> referenced from C:\PROGRAM > >>>>FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ > >>>>[Linker Error] Unresolved external '_PQfinish' > >>>> referenced from C:\PROGRAM > >>>>FILES\POSTGRESQL\7\CLIENT\BCB_01\MAIN.OBJ > >>>> > >>>>What is wrong? I supose that I miss something to configure. > >>>> > >>>>Laszlo Graf > >>>> > >>>>---------------------------(end of > >>>>broadcast)--------------------------- > >>>>TIP 5: Have you checked our extensive FAQ? > >>>> > >>>> http://www.postgresql.org/docs/faqs/FAQ.html > >>>> > >>>> > >> > >>-- > >>Graf László - bitfaragó > >>http://grafl.port5.com/ > >> > >> > > -- > Graf László - bitfaragó > http://grafl.port5.com/ > >