• 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: NSObjCRuntime.h won't compile? Or .mm files?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSObjCRuntime.h won't compile? Or .mm files?


  • Subject: Re: NSObjCRuntime.h won't compile? Or .mm files?
  • From: "John C. Daub" <email@hidden>
  • Date: Fri, 23 Sep 2005 10:53:20 -0500
  • Thread-topic: NSObjCRuntime.h won't compile? Or .mm files?

on 9/23/05 10:22 AM, Bob Sabiston at email@hidden wrote:

>>
>> Well there ya go.  That "-x c++" needs to be "-x objective-c++".
>> (And there should only be one of them).  Now we just need to find
>> out why it isn't.
>>
>> Can you check your Other C Flags in your target settings and see if
>> "-x c++" is set there?
>>
>> Chris
>
> I took that out, and now the .mm file compiles!
>
> However, taking that out seems to have caused trouble with some of my
> ".c" files.  One of them gave me compile errors, and I switched the
> name of it to ".cpp" and it worked.  However, now it is compiling and
> giving me unknown symbols for a few functions  that are defined in .c
> files.
>
> Do all of my .c files need to be .cpp, then?  Or is there a way to
> get it to compile those as they are?

If those functions defined in the .c files are getting unknown symbols when
the .h file is #included into a .cpp file (confused yet?), then it might be
because of name mangling.

Try ensuring the function declarations in the .c's .h file are wrapped up in
extern "C", like:


----- foo.h

#ifdef __cplusplus
    extern "C" {
#endif

    // insert all your function declarations here

#ifdef __cplusplus
    }
#endif

---- foo.c

#include "foo.h"

// whatever


----- bar.cpp

#include "foo.h"

// whatever



That may be the issue.

--
John C. Daub }:-)>=
<mailto:email@hidden> <http://www.hsoi.com/>
"Don't be such an ass, Sam." - John Kay



 _______________________________________________
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: NSObjCRuntime.h won't compile? Or .mm files? (From: Bob Sabiston <email@hidden>)

  • Prev by Date: 2 byte wchar_t...
  • Next by Date: Re: 2 byte wchar_t...
  • Previous by thread: Re: NSObjCRuntime.h won't compile? Or .mm files?
  • Next by thread: Re: NSObjCRuntime.h won't compile? Or .mm files?
  • Index(es):
    • Date
    • Thread