Re: Link error for "mach_absolute_time"
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:12:54 +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