June 28th, 2002, 09:07 PM
Help: Function Placement in C++
I have these two voids that each call on the other. This is because one refreshes the screen and handles some other stuff, the other asks a question. The question one calls on the refresh after an answer is given and then the refresh ends up calling on the question again to get another answer.
The problem is, when I go to compile, it acts as if the other void doesn't exist if it's below the current one. I am using the MinGW port of GCC for Windows.
Is there a compiler option or something to fix this? Am I just not writing my code right?
Note: I am a new to C++ but not to programming.
June 28th, 2002, 11:23 PM
Are you declaring both of these functions in a header file?
June 28th, 2002, 11:53 PM
Ah, nope. So I would just use something like "void VoidName();" in an .h file and include it? I knew I should have been able to find it myself if only I knew what I was looking for .
June 29th, 2002, 12:07 AM
Yep, that should do it for you.
June 29th, 2002, 09:44 AM
You could do that or you could make a protoype of last void at the top. Something like
cout<<"Select one of the options:\n";
cout<<"1) do this and that\n 2) dont do this and that\n";
Pardon me if something obvous is messed up - I'm more of a c guy rather then c++
And you know I mean that.
June 29th, 2002, 06:28 PM
That is why I said to use a header file instead of putting it in the same file. I am so use to using a header file with c.