Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Mar 2002 09:41:15 -0500
From:      Brian T.Schellenberger <bts@babbleon.org>
To:        Aleksander Rozman - Andy <andy@kksonline.com>, freebsd-hackers@FreeBSD.ORG
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: How to write code in FreeBSD
Message-ID:  <20020302144115.DE38CBA03@i8k.babbleon.org>
In-Reply-To: <5.0.2.1.0.20020302125303.02c1ca90@164.8.8.5>
References:  <5.0.2.1.0.20020302125303.02c1ca90@164.8.8.5>

next in thread | previous in thread | raw e-mail | index | archive | help
On Saturday 02 March 2002 06:57 am, Aleksander Rozman - Andy wrote:
> Hi !
>
> I was wondering if there are any guidelines how to write code in FreeBSD. I
> have taken a look at several code of FreeBSD but each is written
> differently? Problem is I don't know which is preferred way.
>
> Reason I am asking this is that I am trying to add some code to kernel.
> Compile is OK, no error, no warning, but on link all variables defined with
> extern are marked as : undefined reference to 'variable', variable is
> extern and .h file which has it defined is included... Where can be the
> problem?? Another problem is that I get multiple definition error...how can
> I get over this.

There's notthing "special" about FreeBSD in this regard.  You have to have 
*some* file which does *not* refer to the variables as "extern" since 
"extern" means "defined someplace else in the link," and if *every* file says 
tha they are defined in some *other* file, well, then, they never get 
defined--just declared.

THis is a basic "C" quesiton, not a "FreeBSD" question.

-- 
Brian T. Schellenberger . . . . . . .   bts@wnt.sas.com (work)
Brian, the man from Babble-On . . . .   bts@babbleon.org (personal)
                                ME -->  http://www.babbleon.org
http://www.eff.org   <-- GOOD GUYS -->  http://www.programming-freedom.org 



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?20020302144115.DE38CBA03>