• 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: Forcing G++ for linking?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Forcing G++ for linking?


  • Subject: Re: Forcing G++ for linking?
  • From: Eric Albert <email@hidden>
  • Date: Tue, 20 Sep 2005 21:46:44 -0700

On Sep 20, 2005, at 9:33 PM, Brad Oliver wrote:

On Sep 20, 2005, at 7:15 PM, email@hidden wrote:

How do I force Xcode to use G++ to link a binary instead of GCC? Is
that even possible?


No one responded, but I figured out one way of doing this: Create a C+ + file, write a dummy C++ class, add it to the target, and build. Then Xcode will use G++ to link the binary.

Maybe I'm confused, but what problem are you trying to solve? As I understand it, G++ (and for that matter, gcc) isn't a linker - ld is. As far as I know, it doesn't make sense to force "g++ to link", since g++ is a compiler, not a linker. This indicates to me that either I don't understand something or you're trying to solve a problem that's linker, rather than compiler, related.

Actually, it's generally recommended to use gcc or g++ to link instead of ld because the compiler knows what system libraries need to be added to the link line (e.g. libSystemStubs.a, libstdc++.dylib, etc.) based on what it's giving to the linker, but ld doesn't know what the libraries it's given need.


Xcode uses gcc or g++ to link. That's why if you want Xcode to use a linker flag that the compiler doesn't recognize, like the rather useful -Y to find the name of the object file referencing an undefined symbol, you have to use the "-Wl" option in Xcode's Other Linker Flags setting instead of passing the flag directly. For example, for -Y you'd set Other Linker Flags to "-Wl,-Y -Wl,1000".

-Eric

_______________________________________________
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


References: 
 >Re: Forcing G++ for linking? (From: Brad Oliver <email@hidden>)

  • Prev by Date: Re: [PARTIALLY SOLVED]Re: Forcing G++ for linking?
  • Next by Date: Re: BugReport: Build after changing build config compiles old code
  • Previous by thread: Re: Forcing G++ for linking?
  • Next by thread: BugReport: Build after changing build config compiles old code
  • Index(es):
    • Date
    • Thread