Обсуждение: C program compilation

Поиск
Список
Период
Сортировка

C program compilation

От
"Gustavo R. Bonet"
Дата:
I'm a beginner in PostGreSQL and I'm trying to meka my first interface with
a C
program.

Like the documentation says, I'm using the following sentence to compile:

gcc -o output_name -I /usr/include/pgsql -lpq myprogram.c

But, in two diferent Linux servers the answer was:

/usr/lib/libpq.so: undefined reference to `crypt'
collect2: ld returned 1 exit status

I have tryed with millons ways changing the order, including other paths,
etc. ... and
nothing.

If you have the answer or can guide me to some "doc", please response this
mail to:

gbonet@bna.com.ar

Thank you !

Gustavo R. Bonet
Buenos Aires
Argentina



Re: C program compilation

От
Alfred Perlstein
Дата:
* Gustavo R. Bonet <gbonet@bna.com.ar> [001027 14:54] wrote:
> I'm a beginner in PostGreSQL and I'm trying to meka my first interface with
> a C
> program.
> 
> Like the documentation says, I'm using the following sentence to compile:
> 
> gcc -o output_name -I /usr/include/pgsql -lpq myprogram.c
> 
> But, in two diferent Linux servers the answer was:
> 
> /usr/lib/libpq.so: undefined reference to `crypt'
> collect2: ld returned 1 exit status

try adding '-lcrypt' to the compile flags.

-Alfred (who also stumbled on this)


Re: C program compilation

От
"Ross J. Reedstrom"
Дата:
On Fri, Oct 27, 2000 at 01:07:12PM -0300, Gustavo R. Bonet wrote:
> I'm a beginner in PostGreSQL and I'm trying to meka my first interface with
> a C
> program.
> 
> Like the documentation says, I'm using the following sentence to compile:
> 
> gcc -o output_name -I /usr/include/pgsql -lpq myprogram.c
> 
> But, in two diferent Linux servers the answer was:
> 
> /usr/lib/libpq.so: undefined reference to `crypt'
> collect2: ld returned 1 exit status
> 
> I have tryed with millons ways changing the order, including other paths,
> etc. ... and
> nothing.


Ah, but did you try to find out where crpyt is defined on your system? I
bet it's in a libcrypt (it used to be in libc), so try something like:
gcc -o output_name -I /usr/include/pgsql -lpq -lcrypt myprogram.c

Ross Reedstrom
-- 
Open source code is like a natural resource, it's the result of providing
food and sunshine to programmers, and then staying out of their way.
[...] [It] is not going away because it has utility for both the developers 
and users independent of economic motivations.  Jim Flynn, Sunnyvale, Calif.


Re: C program compilation

От
Thomas Lockhart
Дата:
> Like the documentation says, I'm using the following sentence to compile:
> gcc -o output_name -I /usr/include/pgsql -lpq myprogram.c
> /usr/lib/libpq.so: undefined reference to `crypt'
> collect2: ld returned 1 exit status

Try adding "-lcrypt" to the line.
                   - Thomas