Re: Xcode Linker
Re: Xcode Linker
- Subject: Re: Xcode Linker
- From: Chris Hanson <email@hidden>
- Date: Wed, 20 May 2009 17:04:26 -0700
When linking, Xcode will invoke either gcc or g++ as appropriate for
the types of files in the project; this determines what additional
libraries the project will be linked against automatically.
I suspect App 1 is linking successfully because it uses some C++ or
Objective-C++ itself, which causes it to link against the C++ runtime;
I suspect that App 2 only uses C and Objective-C, which causes it to
not link against the C++ runtime.
You could add a dummy C++ source file to App 2 in order to force it to
link against the C++ runtime. To avoid the time and disk space hit of
generating a precompiled prefix file for that dummy C++ source file,
you could set the GCC_PFE_FILE_C_DIALECTS build setting to "c
objective-c" so C++ doesn't use any precompilation.
Something to remember about Mac OS X development, and UNIX development
in general: Static libraries of the form foo.a aren't linked within
themselves; they're archives of .o files that get linked when
something that references them is linked. This is different than
CodeWarrior static libraries on Mac OS 9, or static libraries on
Windows.
-- Chris
On May 20, 2009, at 9:30 AM, K. Chen wrote:
No, the missing symbol is a C++ class. The library is built with GCC
4 and the final executable is generated by Objective-C linker.
-KC
On Wed, May 20, 2009 at 9:22 AM, Shawn Erickson <email@hidden>
wrote:
On Wed, May 20, 2009 at 9:18 AM, K. Chen <email@hidden>
wrote:
> I ran into an interesting scenario where I have a static library
used by two
> different apps. App 1 is built and run successfully but App 2
isn't, failing
> on a missing symbol from the static library. I used 'nm' to verify
that
> symbol was indeed undefined. So my question is what causes this
difference
> and how is possible for App 1 to be built with success (shouldn't
the linker
> resolve all the symbols at build time)?
> Note that the library is made out of a set of C++ code and the
apps are
> written in Objective-C.
As a guess...
Is the missing code an Objective-C class, etc.? If it is look at the
-ObjC linker option.
-Shawn
_______________________________________________
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
_______________________________________________
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