Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Dec 1998 18:26:46 -0500 (EST)
From:      Spidey <spidey@jsp.umontreal.ca>
To:        freebsd-questions <freebsd-questions@FreeBSD.ORG>
Subject:   C++ + crypt, how???
Message-ID:  <Pine.BSF.3.96.981217181713.3797A-100000@localhost.jsp.umontreal.ca>

next in thread | raw e-mail | index | archive | help
Hi!

This may look strange, but I'm trying to use the libcrypt library within a
C++ program. I don't know C++ very well, and I was wondering if this was
possible... What I am trying is to use the crypt(char*, char*) function of
the libcrypt library, but I get:

$ g++ lib.cc
lib.cc: In function `int main()':
lib.cc:155: warning: implicit declaration of function `int crypt(...)'
lib.cc:155: warning: assignment to `char *' from `int' lacks a cast
/var/tmp/ccOg37981.o: Undefined symbol `_crypt' referenced from text
segment
$

So I guessed that I must use a -l switch (I'm really learning C now..):

$ g++ -lcrypt lib.cc
lib.cc: In function `int main()':
lib.cc:155: warning: implicit declaration of function `int crypt(...)'
lib.cc:155: warning: assignment to `char *' from `int' lacks a cast
$

Better! But I still get the wrong definition for the crypt fonction, why?

I'm quite sure that this is not because I forgot a header file. Is these
libraries only there to use with C, or can the G++ compiler handle this?


I'm lost. Sorry if this is misplaced, but you guys are the only ones I can
trust... If not please give me a hint of where to look next!

Thanks a lot!

Spidey

How 'bout a little ride through your own world?
http://www.JSP.UMontreal.CA/~beaupran/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.981217181713.3797A-100000>