473,221 Members | 1,778 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,221 software developers and data experts.

[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
Nov 14 '05 #1
1 4924
Laszlo <gr*********@axis.hu> wrote:
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
<OT>
Shouldn't that be "Library" instead of "Librariy"?
</OT>
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
<OT>
PQconnectdb() is never called in your program, but instead
PQsetdb(), so it looks as if you're not posting the error
messages you got when you tried to link the above program.
</OT>
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.


Sorry, but that's not a question about C at all but about a) why the
linker doesn't do what you want it to do and b) how to use your IDE.
And that's both off-topic here. You will get better replies from a
group or forum that deals with your IDE (BCP) and linker.

Regards, Jens
--
\ Jens Thoms Toerring ___ Je***********@physik.fu-berlin.de
\__________________________ http://www.toerring.de
Nov 14 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: KS | last post by:
I am getting linker error for a code that was tested and running. I opened the project in VS.NET 2003 and now i get these errors - I am sure it is some options issue. Can anyone please help? ...
1
by: endo55 | last post by:
Hi I've got the following errors when trying to compile a program cvision error LNK2001: unresolved external symbol _IID_IGraphBuilde cvision error LNK2001: unresolved external symbo...
4
by: Joel Whitehouse | last post by:
Hello All, I have a Visual C++ 2003 dll solution in a directory called "Antenna Test Range Control", and when I comile it, I get the error LNK1104: cannot open file "antenna.obj". When I remove...
3
by: ac2806 | last post by:
Hi I want to use the static MFC within a dll, but I get the following errors when linking: nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv nafxcwd.lib(appcore.obj)...
3
by: Chucker | last post by:
Hi Folks, I got a Wrapper Dll around a native C++ static library. In .NET 1.1 this worked fine. When moving to .NET 2.0 I get a couple of unresolved externals / linker errors: Error 16 error...
1
by: developer | last post by:
Hi All I have made a .NET project. the files included are borland c++ files that i am migrate to VC++ .NET I am using Microsoft Visual C++ .NET 2003. the compilation goes through properly,...
4
by: yOtA | last post by:
I get this Linker Errors while compiling my program: Error: Unresolved external 'vminit()' referenced from C:\TESTE\TESTE.OBJ Error: Unresolved external 'vmalloc(void *, int, unsigned int,...
1
by: iiitsunny | last post by:
i have ported one project which was working in VC6 to VC7. Now the project is working fine in VC7 also. I have made some additions in VC7 environment only. But the problem is that the project is not...
1
by: Deepath G | last post by:
This is deepath.. I am getting some linker error when i am trying to connect Websphere MQ using Borland C++ Builder 2006 using imqi.hpp on windows. Error Message ----------------------- ...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.