NO

Author Topic: Absolute newbie to PellesC could use a helping mind...  (Read 440 times)

Offline TUA

  • Member
  • *
  • Posts: 1
Absolute newbie to PellesC could use a helping mind...
« 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!

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1889
Re: Absolute newbie to PellesC could use a helping mind...
« Reply #1 on: December 30, 2019, 08:01:33 am »
You just need to add libpq library to polink command line.
May the source be with you

Offline TUA

  • Member
  • *
  • Posts: 1
Re: Absolute newbie to PellesC could use a helping mind...
« Reply #2 on: December 30, 2019, 11:52:16 pm »
Thanks - much appreciated