Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: xnu-1228 header files




On 21 Mar 2008, at 22:26, Augusto Callejas wrote:
=====
#include <sys/sysctl.h>

int main(int argc, char **argv)
{
 return 0;
}
=====

however that include generates a "previous definition" error via the
"_structs.h" header file:

====
macbook. g++ -I/Users/username/xnu-1228/bsd -Wall -o bug bug.c
/usr/include/time.h:89: error: redefinition of ‘struct timespec’
/Users/augusto/xnu-1228/bsd/sys/_structs.h:89: error: previous definition of
‘struct timespec’
====


is this a bug or am i performing a bad include?

If you look at "man 3 sysctl", you can see:

NAME
sysctl, sysctlbyname, sysctlnametomib -- get or set system information


LIBRARY
     Standard C Library (libc, -lc)

SYNOPSIS
     #include <sys/types.h>
     #include <sys/sysctl.h>
...

So you have to include sys/types.h before you include sys/sysctl.h


Jonas _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden
References: 
 >xnu-1228 header files (From: Augusto Callejas <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.