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: James Walker <email@hidden>
- Date: Mon, 13 Jun 2011 12:10:54 -0700
On 6/13/2011 11:27 AM, Fritz Anderson wrote:
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.
Sorry, I was trying to keep it simple, but maybe I oversimplified. The
extern declaration is in a header, and the global variable is used in
several source files, which of course #include the header. The
definition (without the extern keyword) is in just one of those sources.
--
James W. Walker, Innoventive Software LLC
<http://www.frameforge3d.com/>
_______________________________________________
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