Xcode 3.2.1 Fnested Functions

7 replies [Last post]
abdullahalshackarchi
abdullahalshackarchi's picture
Title: NooBot+
Joined: 01/21/2010
Posts:
BotPoints: 30
User offline. Last seen 7 years 49 weeks ago.

Dear Forum,

I have KISS-C 2.2.1 and Xcode 3.2.1 (both 64-bit) installed on my Snow Leopard MacBook Pro. I wrote a program that contains many other functions, according to the way we did it during the Botball workshop. When I attempt to compile, it gives me the error "error: nested functions are disabled, use -fnested-functions to re-enable".

From googling it has become apparent that nested functions have been disabled with the new Xcode released by Apple, as it was causing some sort of thread bug. I have limited knowledge of programming, so I don't really understand nested functions. However, when I tried the code on a PC, it compiled without any trouble.

I am in the process of testing this on another Mac and directly on the CBC. Any ideas?

P.S. Kindly note that I did not attach the code as it is one of our Botball competition programs.

abdullahalshackarchi
abdullahalshackarchi's picture
Title: NooBot+
Joined: 01/21/2010
Posts:
BotPoints: 30
User offline. Last seen 7 years 49 weeks ago.

Update: We just tested this on another MacBook Pro with the exact same software. The problem is persistent.

Thanks,
Abdullah

Jeremy Rand
Jeremy Rand's picture
Title: Botball Youth Advisory Council
Joined: 04/03/2009
Posts:
BotPoints: 1168
User offline. Last seen 7 years 28 weeks ago.

I don't know how to fix this on the MacBook Pro, but I strongly suspect that compiling on the CBC-side will fix this. You can either use a flash drive to do this, or you might try WiFi downloads using the Norman/Nease Mods. Thing is, the Norman/Nease Mods were never tested on a Mac; we only had Windows and Linux available to test. I assume that getting them to work with Macs would be easy though.

If you figure anything out or find a workaround that works well for you, please let us know! :-)

-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS

abdullahalshackarchi
abdullahalshackarchi's picture
Title: NooBot+
Joined: 01/21/2010
Posts:
BotPoints: 30
User offline. Last seen 7 years 49 weeks ago.

Problem solved... Apparently the program can only take 6 functions apart from the main function. We had 7.

Jeremy Rand
Jeremy Rand's picture
Title: Botball Youth Advisory Council
Joined: 04/03/2009
Posts:
BotPoints: 1168
User offline. Last seen 7 years 28 weeks ago.

Glad you figured it out. That is quite weird though... you might want to contact KIPR tech support about this; having a limit of 6 functions is pretty restrictive.

-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS

matthewbot
Title: YAC
Joined: 04/12/2009
Posts:
BotPoints: 94
User offline. Last seen 12 years 20 weeks ago.

Nested functions are when you declare a new function inside of another one, like this:

  1. void main() {
  2. printf("Hello ");
  3. void func() {
  4. printf("World\n");
  5. }
  6.  
  7. func();
  8. }

They're a nonstandard C extension that almost nobody uses. You may not have done this intentionally, but try indenting your program and double checking all of your brackets to be sure you have completely closed one function before starting the next. Or you can post your code here. Xcode does not have a limit on the number of functions you can have. I suspect you just deleted the code containing a nested function and the error went away.

--
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction.

Albert Einstein

Project Quadcopter: http://quadcopter.wordpress.com/

abdullahalshackarchi
abdullahalshackarchi's picture
Title: NooBot+
Joined: 01/21/2010
Posts:
BotPoints: 30
User offline. Last seen 7 years 49 weeks ago.

Yup... I just reviewed the old code and that seems to be it. I added the code from the function without a final closing bracket to another function, hence solving the problem.

Thanks for the help :)

Natahana
Title: NooBot
Joined: 09/25/2018
Posts:
BotPoints: 24
User offline. Last seen 3 years 40 weeks ago.

If there are many sad stories, share it with the people you trust. Sharing helps people get closer together and you also relieve some of that sadness.
Madalin Stunt Cars 2