• 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: link error on global variable in static library
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: link error on global variable in static library


  • Subject: Re: link error on global variable in static library
  • From: Fritz Anderson <email@hidden>
  • Date: Mon, 13 Jun 2011 13:27:38 -0500

On 13 Jun 2011, at 1:05 PM, James Walker wrote:

> When I try to link an app with a certain static library, I get this error from Xcode 3.2.6:
>
> Undefined symbols:
>  "_g_bar", referenced from:
>      _g_bar$non_lazy_ptr in libLexSaurusSpeller.a(BTOPEN.o)
>     (maybe you meant: _g_bar$non_lazy_ptr)
>
> That "maybe you meant" part isn't very enlightening.
>
> The static library is C code compiled with GCC 4.0.  I can see that one source file has
>
>  int g_bar;
>
> in global scope, and another (BTOPEN.c) has
>
>  extern int g_bar;
>
> in global scope.  I expect I can work around the problem by introducing accessor functions, but what could I be missing?

Just so I'm clear: Those are the only two declarations of that symbol? Then you should either remove the extern declaration or find some place (a .c or .m file) to declare storage for the global, with
	int	g_bar;
in global scope.

	— F

 _______________________________________________
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: link error on global variable in static library
      • From: James Walker <email@hidden>
References: 
 >link error on global variable in static library (From: James Walker <email@hidden>)

  • Prev by Date: link error on global variable in static library
  • Next by Date: Re: Xcode workflow
  • Previous by thread: link error on global variable in static library
  • Next by thread: Re: link error on global variable in static library
  • Index(es):
    • Date
    • Thread