crypt() won't be found by the linker

crypt() won't be found by the linker

Post by Uwe Boss » Tue, 19 Jun 2001 00:05:01



I want to check, whether a password given by a user is correct or not.
I found the following manpage for crypt:

#define _XOPEN_SOURCE
#include <unistd.h>

char *crypt(const char *key, const char *salt);

... and thought, this is, what I have been looking for.
Take the users password, crypt it and compare the result with the
contents of /etc/passwd.
But the following went wrong:
first g++ didn't find the header of crypt. After a look at unistd.h I
changed
#define _XOPEN_SOURCE into
#define __USE_XOPEN
Now, the compilation succeeded, but the linker told me:
undefined reference to 'crypt'.

What is my mistake?

 
 
 

crypt() won't be found by the linker

Post by Carlos Moren » Tue, 19 Jun 2001 00:29:43



> Now, the compilation succeeded, but the linker told me:
> undefined reference to 'crypt'.

> What is my mistake?

Did you use the switch -lcrypt when compiling?

Carlos
--

 
 
 

crypt() won't be found by the linker

Post by Eugene Mayevsk » Tue, 19 Jun 2001 01:01:26


Quote:> Now, the compilation succeeded, but the linker told me:
> undefined reference to 'crypt'.
> What is my mistake?

Add -lcrypt to compiler command line.

--
Sincerely yours,
Eugene Mayevski

 
 
 

crypt() won't be found by the linker

Post by Harley_.. » Wed, 20 Jun 2001 03:35:28


OUtstanding....
You guys have answered a question that has haunted me for weeks.
This newsgroup is awesome.

Thanks,
Kelvin


> > Now, the compilation succeeded, but the linker told me:
> > undefined reference to 'crypt'.
> > What is my mistake?

> Add -lcrypt to compiler command line.

> --
> Sincerely yours,
> Eugene Mayevski

 
 
 

crypt() won't be found by the linker

Post by Uwe Boss » Wed, 20 Jun 2001 04:14:22


Quote:> Did you use the switch -lcrypt when compiling?

No, I didn't, and now it works. Thank you. (I'm really a beginner).
 
 
 

1. New US Robotics modem won't dial; browser won't find web pages

I've got a successful connection with my new US Robotics modem (model 6510B)
using the debug option of the dial configuration (in Red Hat 7.2). It gets a
good PPP
connection.  However, I can't connect using the
PPP dialer.  It won't even dial. How do I get the dialer to dial?

Also, even when the dial configuration debug gets a connection the browser
won't find any web pages (when I've connected using debug).
I've added the domain name server IP address to the configuration.  What
else can I do to get the browser (any browser) to find web pages?

--
Per Ford Motor Company's Corporate Security Manual section 2.4.25: "the
opinions expressed in the article are the opinions of the author, not of
Ford Motor Company. "

2. xv does not work

3. The linker ld from binutils 2.5.2.1 won't work for me

4. redhat 5.2 setup questions...?

5. help ... linker just won't link ...

6. Future of SISCAD-P/Linux V2.0

7. linker can't find X libs after ELF upgrade

8. Simplified scalable cpu bitmasks

9. Linker doesn't find _sqrt and other math functions

10. Help--linker can't find library(?)

11. Why can't the linker find the libraries (they _are_ there)

12. X won't start "could not find font 'fixed'"

13. linker can't find libs