• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: linking error?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: linking error?


  • Subject: Re: linking error?
  • From: Jeffrey Oleander <email@hidden>
  • Date: Sun, 3 Aug 2008 15:04:38 -0700 (PDT)

> On Sat, 2008/08/02, Stephane Sudre <email@hidden> wrote:
> From: Stephane Sudre <email@hidden>
> Subject: Re: linking error?
> To: email@hidden
> Date: Saturday, 2008 August 2, 17:25
>> On 2008 Aug 3, at 00:04, Michael wrote:
>> I am getting a "linking" error and not too
>> sure how to deal with this.
>>
>> Set up.
>> Standard Tool.
>> Two files.
>>
>> Main.c  Defines: static char option = 0;
>>
>> String_tools.c
>> int foo() { extern int  option; ......}
>>
>> The error is as follows.
>>
>> linking/Users....../
>> "_option" referenced from
>> _option$non_lazy_ptr in ...   .o
>> symbol(s) not found.
>> collect2: Id returned.
>>
>> Now, I assume I know what it means...well I
>> think I do...but I am not sure what is causing
>> this or how to correct it.
>
> You're referencing a static char from another
> file as an extern int in a function.
>
> You started programming in C 2 minutes ago?

I've been programming in C for about 22 years.
That was about the same time I gave up trying
to memorize fine points of every programming
language's standard.  To me, a "static" has
nothing to do with what file it was declared in
but in what program block it was declared, and
that's why the "extern" is necessary to refer
to it from elsewhere.  So, what are we missing?



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: linking error?
      • From: Andy Lee <email@hidden>
References: 
 >Re: linking error? (From: Stephane Sudre <email@hidden>)

  • Prev by Date: Re: moving from Xcode 2.5 -> 3.1: problem building a USB kernel driver
  • Next by Date: Optimal environment to compile C
  • Previous by thread: Re: linking error?
  • Next by thread: Re: linking error?
  • Index(es):
    • Date
    • Thread