473,387 Members | 1,876 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,387 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 4945
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 ----------------------- ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.