• 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: Shaun Wexler <email@hidden>
  • Date: Fri, 16 Sep 2005 09:40:13 -0700

On Sep 16, 2005, at 7:08 AM, Matt Neuburg wrote:

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.

Only define it once, in a common header:

#define MyLog(format, args...) \
#ifdef DEBUG \
NSLog(format, args...) \
#endif

It will be a NOP unless you are debugging, but always defined.
--
Shaun Wexler
MacFOH
http://www.macfoh.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
References: 
 >Re: Can Xcode allow multiple definitions of a fn? (From: Matt Neuburg <email@hidden>)

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