Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Nov 1999 23:07:24 +0000
From:      Ben Smithurst <ben@scientia.demon.co.uk>
To:        patrik@astrom.net
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Error compiling..
Message-ID:  <19991128230724.A926@strontium.scientia.demon.co.uk>
In-Reply-To: <Pine.BSF.4.10.9911282245280.56372-100000@styx.astrom.net>
References:  <Pine.BSF.4.10.9911282245280.56372-100000@styx.astrom.net>

next in thread | previous in thread | raw e-mail | index | archive | help
patrik@astrom.net wrote:

> Im trying to compile a program and IM getting a errormessage, I have
> included the error message bellow.
> 
> viking# cc emsg1.c 
> emsg1.c: In function `main':
> emsg1.c:197: warning: passing arg 2 of `connect' from incompatible pointer
> type
> /var/tmp/ccRu22801.o: In function `main':
> /var/tmp/ccRu22801.o(.text+0x5bb): undefined reference to `cuserid'
> viking#
> 
> The software IM trying to compile is a network monitoring tool named
> "EMU", I've found it at "http://www.jarrix.com.au".
> 
> At line 197 it looks like this...
> 
> if( connect(s, &sin, sizeof(sin)) < 0) {

Cast the second argument to (struct sockaddr *). i.e.

	if (connect(s, (struct sockaddr *)&sin, sizeof sin) < 0) {
		...

> And where it complains about the "cuserid" bit it looks like this...
> 
> /* get my user name */
>         if (u_flag == 0) {
>                 cuserid(myuser);
>         } 

RTFM. "man cuserid" says:

DESCRIPTION
     The cuserid function is made obsolete by getpwuid.
     It is available from the compatibility library, libcompat.

So you need to add -lcompat to the command line, or take the manual
page's advice and use getpwuid (with an argument of geteuid()) instead,
and copy the pw_name member of the returned structure to myuser.

-- 
Ben Smithurst            | PGP: 0x99392F7D
ben@scientia.demon.co.uk |   key available from keyservers and
                         |   ben+pgp@scientia.demon.co.uk


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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991128230724.A926>