C language > Beginner questions

Absolute newbie to PellesC could use a helping mind...

(1/1)

TUA:
As my first adventure in Pelle's world, I wanted to compile the code snippet from the "Retrieving multiple rows of data" section
from here:

http://zetcode.com/db/postgresqlc/

I made some tiny changes to accommodate my db/host/creds only.

I had to move the following three header files from my PostgreSQL 12.1 install into the Include directory of my PellesC install for them to be found by the compiler:

libpq-fe.h
pg_config_ext.h
postgres_ext.h

Now it compiles - I do, however, receive these linker errors:

POLINK: error: Unresolved external symbol 'PQfinish' - referenced from 'D:\projects\PellesC\PostgreSQL\Main\output\pg_main.obj'.
POLINK: error: Unresolved external symbol 'PQconnectdb' - referenced from 'D:\projects\PellesC\PostgreSQL\Main\output\pg_main.obj'.
POLINK: error: Unresolved external symbol 'PQstatus' - referenced from 'D:\projects\PellesC\PostgreSQL\Main\output\pg_main.obj'.
POLINK: error: Unresolved external symbol 'PQerrorMessage' - referenced from 'D:\projects\PellesC\PostgreSQL\Main\output\pg_main.obj'.
POLINK: error: Unresolved external symbol 'PQexec' - referenced from 'D:\projects\PellesC\PostgreSQL\Main\output\pg_main.obj'.
POLINK: error: Unresolved external symbol 'PQresultStatus' - referenced from 'D:\projects\PellesC\PostgreSQL\Main\output\pg_main.obj'.
POLINK: error: Unresolved external symbol 'PQclear' - referenced from 'D:\projects\PellesC\PostgreSQL\Main\output\pg_main.obj'.
POLINK: error: Unresolved external symbol 'PQntuples' - referenced from 'D:\projects\PellesC\PostgreSQL\Main\output\pg_main.obj'.
POLINK: error: Unresolved external symbol 'PQgetvalue' - referenced from 'D:\projects\PellesC\PostgreSQL\Main\output\pg_main.obj'.
POLINK: fatal error: 9 unresolved external(s).

I see these all of these functions marked for export in the libpq.dlls I have on my system (all identical from the 12.1 install)

What am I missing/have I done wrong?

Thanks for all help!

TimoVJL:
You just need to add libpq library to polink command line.

TUA:
Thanks - much appreciated

Navigation

[0] Message Index

Go to full version