• 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: Link error for "mach_absolute_time"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Link error for "mach_absolute_time"


  • Subject: Re: Link error for "mach_absolute_time"
  • From: Dirk Stegemann <email@hidden>
  • Date: Tue, 6 Nov 2007 14:13:13 +0200

Hello,

Am 05.11.2007 um 19:57 schrieb Eric Albert:

On 11/5/07, Dirk Stegemann (Mailing-Lists) <email@hidden> wrote:
I'm getting a link error when trying to build a program which uses
the mach_absolute_time() API, under following conditions:

Missing mach_absolute_time is usually a problem with C++ code including C headers which don't have the appropriate 'extern "C"' sections. Try wrapping your #include of whatever header you're using to pull in mach_absolute_time with this:

Thanks, this worked perfectly fine!

I verified it with a newly created "C++ Tool" Xcode project; this code failed to link:

// main.cpp
#include <mach/mach_time.h>

int main (int argc, char * const argv[]) {
    return mach_absolute_time();
}


This code builds fine:

// main.cpp
#if __cplusplus
extern "C" {
#endif
#include <mach/mach_time.h>
#if __cplusplus
}
#endif

int main (int argc, char * const argv[]) {
    return mach_absolute_time();
}



Best,
Dirk Stegemann


_______________________________________________ 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: 
 >Link error for "mach_absolute_time" (From: "Dirk Stegemann (Mailing-Lists)" <email@hidden>)
 >Re: Link error for "mach_absolute_time" (From: "Shawn Erickson" <email@hidden>)
 >Re: Link error for "mach_absolute_time" (From: Eric Albert <email@hidden>)

  • Prev by Date: Re: Link error for "mach_absolute_time"
  • Next by Date: Re: Adding frameworks to a project - adding corresponding search paths to find the headers. Necessary?
  • Previous by thread: Re: Link error for "mach_absolute_time"
  • Next by thread: Getting 'fmt?' error returns from AudioConverterNew ()
  • Index(es):
    • Date
    • Thread