Welcome to Dream.In.Code
Become a C++ Expert!

Join 136,923 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,808 people online right now. Registration is fast and FREE... Join Now!




Nested Function

 
Reply to this topicStart new topic

Nested Function, ERROR: nested functions not allowed

Irishancest
1 Apr, 2008 - 07:29 PM
Post #1

New D.I.C Head
*

Joined: 2 Nov, 2007
Posts: 14


My Contributions
I am getting an error using gcc where it tells me:
"error: nested functions are disabled, use -fnested-functions to re-enable"

it does it when my function calls itself attempting recursion. here is the segment of code that it's calling on.
CODE

    if (X->Number > Z->Number)
    {
        Z->Right = X->Left;
        X->Left = Z;
    }
    else
    {
        Z->Left = X->Right;
        X->Right = Z;
    }
    if (NumRot = 2)
    {
        Rotate(X, Z, Y, 1)

    return X;

User is offlineProfile CardPM
+Quote Post

no2pencil
RE: Nested Function
1 Apr, 2008 - 07:30 PM
Post #2

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 6,495



Thanked: 66 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
Should your last if block have the return in it, or are you missing the closing bracket?

Also, it looks like your call to the Rotate function is missing the semi-colon.
User is online!Profile CardPM
+Quote Post

Irishancest
RE: Nested Function
1 Apr, 2008 - 07:45 PM
Post #3

New D.I.C Head
*

Joined: 2 Nov, 2007
Posts: 14


My Contributions
Thanks. I had caught the semi colon but not the end bracket. Thank you very much. Really. You saved my life here.
User is offlineProfile CardPM
+Quote Post

no2pencil
RE: Nested Function
1 Apr, 2008 - 07:48 PM
Post #4

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 6,495



Thanked: 66 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
And they ate Robin's minstrels, and there was much rejoicing.
User is online!Profile CardPM
+Quote Post

Martyr2
RE: Nested Function
1 Apr, 2008 - 08:54 PM
Post #5

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,231



Thanked: 220 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
* Martyr2 claps from the magic carpet and says...

That was a great story no2pencil. I liked the part where they were all rejoicing and stuff. It made me happy! You tell such great stories. Yay!

This post has been edited by Martyr2: 1 Apr, 2008 - 08:55 PM
User is online!Profile CardPM
+Quote Post

no2pencil
RE: Nested Function
1 Apr, 2008 - 08:57 PM
Post #6

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 6,495



Thanked: 66 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
*meh*

Why must the carpet be magical?
User is online!Profile CardPM
+Quote Post

nirvanarupali
RE: Nested Function
1 Apr, 2008 - 09:13 PM
Post #7

D.I.C Foot
Group Icon

Joined: 1 Aug, 2007
Posts: 983



Thanked: 2 times
Dream Kudos: 375
My Contributions
...because it will fly.
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/3/08 10:16PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month