• 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: Using #define's in .m files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using #define's in .m files


  • Subject: Re: Using #define's in .m files
  • From: Chris Espinosa <email@hidden>
  • Date: Fri, 1 Sep 2006 11:14:14 -0700


On Sep 1, 2006, at 10:00 AM, Steve Mills wrote:

Using #define's in .m files is allowed, right? Such as:


In .pch file:

#include "bob.h"


In bob.h:

#define bob(x) {if(!(x)) SysBeep(0); }


In .m file:

void blah(void)

{

    bob(SomethingThatReturnsFalse());

}


The .pch file is being preprocessed for both c++ and objc. The problem arises when I try to build my release config, in which case the #define is empty:


#define bob(x)


Everything compiles, but the linker says _bob is undefined. When I preprocess a .cpp file that uses bob, I see the expanded macro in the .i file. But when I preprocess a .m file, I see the UNexpanded macro name, like the preprocessor is not really doing anything with #define's.


This should work.  Are you sure that your pch file is set as the Prefix file for the target that's compiling your .m?  

Chris
 _______________________________________________
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

  • Follow-Ups:
    • Re: Using #define's in .m files
      • From: Steve Mills <email@hidden>
References: 
 >Using #define's in .m files (From: Steve Mills <email@hidden>)

  • Prev by Date: Re: Shark and dSYM
  • Next by Date: Re: Using #define's in .m files
  • Previous by thread: Using #define's in .m files
  • Next by thread: Re: Using #define's in .m files
  • Index(es):
    • Date
    • Thread