Including headers for clock_get_system_nanotime et al - how ?
Including headers for clock_get_system_nanotime et al - how ?
- Subject: Including headers for clock_get_system_nanotime et al - how ?
- From: André Berg <email@hidden>
- Date: Wed, 24 Sep 2008 14:17:56 +0200
Hi,
I am fairly new to programming with Xcode. I am trying to replicate an
example from the Kernel Programming Guide > Using Kernel Time Abstractions
(http://developer.apple.com/documentation/Darwin/Conceptual/KernelProgramming/services/chapter_16_section_2.html#//apple_ref/doc/uid/TP30000905-CH219-CHDJBFEF)
--------------- snip ---------------
uint32_t secpart;
uint32_t nsecpart;
uint64_t nsec, abstime;
clock_get_calendar_nanotime(&secpart, &nsecpart);
nsec = nsecpart + (1000000000ULL * secpart); //convert seconds to nanoseconds.
nanoseconds_to_absolutetime(nsec, &abstime);
--------------- snip ---------------
I would also like to use the functions
--------------- snip ---------------
void clock_get_uptime(uint64_t *result);
void clock_get_system_microtime(uint32_t *secs, uint32_t *microsecs);
void clock_get_system_nanotime(uint32_t *secs, uint32_t *nanosecs);
void clock_get_calendar_microtime(uint32_t *secs, uint32_t *microsecs);
void clock_get_calendar_nanotime(uint32_t *secs, uint32_t *nanosecs);
--------------- snip ---------------
but I am having a very hard time including the files necessary for the
linker to reckognize those functions.
Specifically I have tried:
1. "#include <Kernel/kern/clock.h>" which gives me following error message:
In file included from
/Users/andre/Documents/Xcode/CommandLineUtility/CoreServices/abstime/main.c:2:
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Kernel.framework/Headers/kern/clock.h:43:29:
error: kern/kern_types.h: No such file or directory
2. Various settings for the Search Paths section on Project and Target Build
Settings level did not help. I tried including the /Developer/SDKs souce dir
recursively.
3. Passing manual flags to the linker like -L</path/to/Kernel.framework> and
-I</path/to/Kernel.framework> did not help either.
4. Switching on "Build Active Architecture Only" on project and target level
build settings did not help.
The linker (ld) just either does not find those functions or trip up about
the include file (<kern/kern_types.h>), which is included from
<Kernel/kern/clock.h> which is included in my code.
Xcode however does see where the functions are coming from apparently,
because syntax coloring and cmd-double-clicking on the function names does work.
My project is very simple, I just set it up for this purpose. The code I
posted first is all the code in main() for the project...
Now, I know I could just use AbsoluteTimeToNanoseconds() and consorts of
CoreServices.framework but I might post the application to Unix/Linux user
groups later so staying within Mach/Kernel.framework would ease the
transition...
I must be overlooking something basic, but I can't see the forest because of
the trees... maybe you can help?
Even if you can't, I appreciate you investing your valuable time reading this!
Thanks!
André
_______________________________________________
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