Pelles C forum

C language => Beginner questions => Topic started by: TUA on December 30, 2019, 05:44:13 AM

Title: Absolute newbie to PellesC could use a helping mind...
Post by: TUA on December 30, 2019, 05:44:13 AM
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!
Title: Re: Absolute newbie to PellesC could use a helping mind...
Post by: TimoVJL on December 30, 2019, 08:01:33 AM
You just need to add libpq library to polink command line.
Title: Re: Absolute newbie to PellesC could use a helping mind...
Post by: TUA on December 30, 2019, 11:52:16 PM
Thanks - much appreciated