I am trying to program a front end to the Postgres database system but
I am having a problem getting the code to link correctly. When I
compile to the program with
gcc -o sql -lpq sql.c
I get this error
/usr/lib/libpq.so: undefined reference to 'crypt'
collect2: ld returned 1 exit status
Here is some version info:
Red Hat 6.0 distribution of Linux.
Postgres 6.4.x from the Red Hat distribution CD
Here is sql.c , all I am trying to do at this point is to make a
connection to the database and then close the connection:
int main(int argc, char *argv)
conn = PQconnectdb("");
I read the crypt(3) manpage and saw that crpyt() was defined in unistd.hQuote:}
so I added #include <unistd.h> to the source code but this did not
correct my problem.
I read the PostgreSQL Programmer's Guide but it make no mention of any
other required header files.
I figure that because I'm very new at this, my error probably isn't some
obscure bug but rather it is my own ignorance of how to use the tools.