Re: link error on global variable in static library
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