Re: decyphering ld's cryptic error messages
Re: decyphering ld's cryptic error messages
- Subject: Re: decyphering ld's cryptic error messages
- From: Andreas Grosam <email@hidden>
- Date: Thu, 4 Aug 2005 11:15:11 +0200
On 03.08.2005, at 18:06, Stefan Werner wrote:
Hi,
Date: Wed, 3 Aug 2005 12:20:02 +0200
From: Andreas Grosam <email@hidden>
I've spent the last few days reading man pages, FAQs and forums like
crazy, trying to resolve a simple linker error, linking my C++ app
against a static build of wxWidgets:
ld: Undefined symbols:
__ZTV14wxMenuItemList
Most likely, the symbol is just not *accessible* from another dynamic
shared object, because the symbol __ZTV14wxMenuItemList has not been
"exported". Since this is a vtable you need to export the whole class.
Are you talking about dynamic linking? I'm using a static build of
wxWidgets, I thought exporting symbols is only necessary for dylibs.
This is for dynamic linking.
I'm not sure when this might happen in a static build (maybe when you
define that class in an anonymous namespace, or define it in a .cpp
file and when you not statically link them into one module).
Please see also:
<http://developer.apple.com/releasenotes/DeveloperTools/GCC4.html>
<http://gcc.gnu.org/wiki/Visibility>
Thanks for these pointers, I'll have a look.
Note, for the GCC4 compiler all symbols will be exported by default.
I'm using gcc3.3, and to AFAIK exporting all symbols is the default
here too.
Yes, for gcc-3.3, all symbols will be exported.
Then your link error needs more investigation. ;-)
However, in XCode the default build settings for building a shared lib
is that all symbols will be "hidden".
Does this apply to both static and dynamic libraries?
It is not applicable if you are using gcc3 -- all symbols will be
exported.
(exported symbols can be limited with an "exported symbols file",
though)
For gcc-4, you can easily check what XCode 2.1 uses for the default
settings:
There are two compiler options (gcc-4) which control symbol visibility:
-fvisibilty= hidden | default
-fvisibility-inlines-hidden
In XCode 2.1 - gcc-4, the corresponding build settings are:
Symbols Hidden by Default
Inline Functions Hidden
So - either you change the
corresponding build settings (not recommeded) or you explicitly define
the visibility attribute in your source code - which i would do.
Both solutions sound not that exciting to me - if possible, I'd love
to use an unmodified wxWidgets to make it easier to upgrade to newer
versions.
Andreas
Thanks for your help,
Stefan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
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