• 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
Inline function - multiple includes during link
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Inline function - multiple includes during link


  • Subject: Inline function - multiple includes during link
  • From: George Lawrence Storm <email@hidden>
  • Date: Wed, 14 Feb 2007 14:09:36 -0800

I am porting a Windows project to Xcode. I have the following in a .h file which is included in multiple files within the project.

-------------

#ifndef MyConversionH
#define MyConversionH

#ifdef __cplusplus
extern "C"
{
#endif

/* MACOSX has been defined in Xcode */
#ifdef MACOSX
#define __inline __inline__
#endif

#define  MilliUnits 1000

__inline int64_t UnitsToMilliUnits(int64_t myUnit)
{ return (myUnit / MilliUnits); };

#ifdef __cplusplus
}
#endif

#endif

-------------
Even though I have bracketed the entire file with:.

#ifndef MyConversionH
#define MyConversionH
...

#endif

It appears it is added during the compile phase multiple times. I am getting an error during the link phase indicating multiple definitions of symbol _UnitsToMilliUnits

If I change:

#define __inline __inline__

to:

#define __inline extern __inline__

It will compile and link, however by doing this I assume I never actually define the function. It appears to be working in Windows. How do I define this so that GCC will be happy? Has this file been magically cached somewhere and do I need to change one of my Xcode settings which I have missed?

- George Lawrence Storm
DivX, Inc.



 _______________________________________________
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: Inline function - multiple includes during link
      • From: Steve Sisak <email@hidden>
  • Prev by Date: Re: Linker refuses to link my dylib? Why?
  • Next by Date: Re: Linker refuses to link my dylib? Why?
  • Previous by thread: Re: Linker refuses to link my dylib? Why?
  • Next by thread: Re: Inline function - multiple includes during link
  • Index(es):
    • Date
    • Thread