• 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: Can Xcode allow multiple definitions of a fn?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can Xcode allow multiple definitions of a fn?


  • Subject: Re: Can Xcode allow multiple definitions of a fn?
  • From: James Housley <email@hidden>
  • Date: Fri, 16 Sep 2005 10:22:12 -0400

Matt Neuburg wrote:
On Wed, 14 Sep 2005 13:08:34 -0700, Ando Sonenblick
<email@hidden> said:


I'm porting a bunch of static libs from CW to Xcode and they share
various code bits (not my code/design).  As a result, when I have a
project that includes these libs, Xcode gives errors that there are
multiple definitions of these duplicate functions.


Okay, I've got a related question (I think it's related). I get "multiple
definitions" errors when I place a #define macro in the pre-compiled header
file. For example I have a MyLog macro that expands to NSLog ifdef DEBUG but
to nothing othewise, so that I log only in a debug build:

#ifdef DEBUG
#define MyLog(format, args...) \
<and so on>

This used to work fine, but now I'm getting these multiple definition
errors. Did something about the precompilation process change that could be
causing this? How do I properly do this #define so that all of my code can
see it? Thx - m.


One simple fix which is very common in header files is ...

#ifdef DEBUG
#ifndef MyLog
#define MyLog(format, args...) \
<and so on>
#endif /* MyLog */

So that it will only be defined if it isn't already defined.

Jim


-- /"\ ASCII Ribbon Campaign . \ / - NO HTML/RTF in e-mail . X - NO Word docs in e-mail . / \ ----------------------------------------------------------------- email@hidden http://www.FreeBSD.org The Power to Serve email@hidden http://www.TheHousleys.net --------------------------------------------------------------------- It's always a long day, 86400 doesn't fit into a short.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

 _______________________________________________
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: Can Xcode allow multiple definitions of a fn? (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: Apple script from a c file
  • Next by Date: Added version # to dylib
  • Previous by thread: Re: Can Xcode allow multiple definitions of a fn?
  • Next by thread: Re: Can Xcode allow multiple definitions of a fn?
  • Index(es):
    • Date
    • Thread