Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 352745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:45:57+00:00 2026-05-12T11:45:57+00:00

Hey there, I’m sort of new to Objective-C, and well, programming in general. I

  • 0

Hey there, I’m sort of new to Objective-C, and well, programming in general. I have a little experience in C# and c++, to give you a bit of a background. I’m using Xcode to create a simple application that adds 2 fields and returns a sum, and I’ve narrowed it down to one error:

“Nested functions are disabled, use -fnested-functions to re-enable”

Here’s the bit of code I’m having trouble with, any suggestions would be greatly appreciated:

-(IBAction)click:(id)sender;
{
int main (int argc, const char *argv[]){
  NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

  int sum;

  sum = myInt1, myInt2;
  NSLog (name, @", the answer is %i", sum);
  [pool drain];

  return 0;
 }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T11:45:57+00:00Added an answer on May 12, 2026 at 11:45 am

    What you are trying to do here is something which is not generally allowed in C languages. You, in general, cannot create a function inside of another one, like you can in languages like Pascal and JavaScript. You should remove the main stuff from inside click: and just keeps the lines

    int sum;
    
    sum = myInt1, myInt2;
    NSLog (name, @", the answer is %i", sum);
    

    On a broader, note, though, why are you trying to create a main inside of click:? In Objective-C you normally use main() just to create any root-level objects and instantiate the autorelease pool. Assuming you’re working with Xcode on a Mac, if you use one of the templates to get started it should take care of all the details for you of creating main. I’d suggest taking a look at Apple’s Cocoa tutorials to help you get a feel for how a typical Objective-C application is structured.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey there, I'm a designer thats really new to programming with xcode or Objective-C
Hey there programming peps! I have a question re: jQuery. We have a software
hey there, i have a div that expands when the page is loaded, now
Hey there, new to AJAX, JS.. Im trying to add to a Javascript/Ajax search
Hey there I have just started Java for a course I will be taking
Hey there, i am trying to make a little app that will serve multiple
Hey there, assuming I have the following code in a mex routine: mxArray *newPoint
Hey there. been a busy debugger today. ill give ths short version. ive made
Hey there. I have a c# application that parses txt files and imports the
hey there i have this code that should save a file from sql server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.