From owner-freebsd-questions Thu Dec 17 15:26:52 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id PAA03876 for freebsd-questions-outgoing; Thu, 17 Dec 1998 15:26:52 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from localhost.jsp.umontreal.ca (derby.JSP.UMontreal.CA [132.204.45.26]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id PAA03863 for ; Thu, 17 Dec 1998 15:26:41 -0800 (PST) (envelope-from spidey@jsp.umontreal.ca) Received: from localhost (spidey@localhost) by localhost.jsp.umontreal.ca (8.8.8/8.8.8) with SMTP id SAA03834 for ; Thu, 17 Dec 1998 18:26:47 -0500 (EST) (envelope-from spidey@jsp.umontreal.ca) X-Authentication-Warning: localhost.jsp.umontreal.ca: spidey owned process doing -bs Date: Thu, 17 Dec 1998 18:26:46 -0500 (EST) From: Spidey Reply-To: Spidey To: freebsd-questions Subject: C++ + crypt, how??? Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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