Re: error: nested functions are disabled
Re: error: nested functions are disabled
- Subject: Re: error: nested functions are disabled
- From: "Dharmendra Kanejiya" <email@hidden>
- Date: Tue, 3 Jun 2008 05:49:28 +0530
Hello,
I just subscribed to this list after searching for this error. I am trying to build and run a simple example program, but it results in the same error : "nested functions are disabled, use -fnested-functions to re-enable it." Here is the code
#import <Foundation/Foundation.h>
#import "LotteryEntry.h"
int main (int argc, const char *argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
// Create the date object
NSCalendarDate *now = [[NSCalendarDate alloc] init];
// Seed the random number generator
srandom(time(NULL));
NSMutableArray *array;
array = [[NSMutableArray alloc] init];
int i;
for (i = 0; i < 10; i++){
// Create a date/time object that is 'i' weeks from now
NSCalendarDate *iWeeksFromNow;
iWeeksFromNow = [now dateByAddingYears:0
months:0
days:(i * 7)
hours:0
minutes:0
seconds:0];
// Create a new instance of LotteryEntry
LotteryEntry *newEntry = [[LotteryEntry alloc] init];
[newEntry prepareRandomNumbers];
[newEntry setEntryDate:iWeeksFromNow];
// Add the LotteryEntry object to the array
[array addObject:newEntry];
}
for (LotteryEntry *entryToPrint in array) {
// Display its contents
NSLog(@"%@", entryToPrint);
}
[pool drain];
return 0;
}
The error occurs at the "
for (LotteryEntry *entryToPrint in array) { " line. I don't know how to fix it. I am running Xcode 2.4.1 on Powerbook G4 with Mac OS X 10.4.11
Thanks
- Subject: Re: error: nested functions are disabled
- From: "Ken G. Brown" <email@hidden>
>Date: Tue, 6 May 2008 11:36:08 -0700
>From: "Mark Wagner" <email@hidden>
>Subject: Re: error: nested functions are disabled
><>> For some reason I started getting this error in a project that was compiling fine before I added a couple functions:
>> error: nested functions are disabled, use -fnested-functions to re-enable
>>
>> I don't believe I have any nested functions. And commenting out the functions I added does not help.
>
>Odds are you've got a missing close bracket somewhere.
You are absolutely right!
Just found a backwards } in an if statement. Sighhh...
Found it by doing Balance from the Contextual menu to highlight what the compiler thought was the section being enclosed.
I was sure I had done all that before too but somehow missed the nasty little @#!$! :)
Had to step away from it for awhile and come back fresh.
Thx,
Ken
> > I am also getting lots of warnings like:
>> warning: incompatible implicit declaration of built-in function 'strncat' when compiling example code.
>> Can anyone suggest what to look for in order to avoid these warnings?
>
>Perhaps you should #include the header files declaring those functions?
>
>--
Mark Wagner
_______________________________________________
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