Mail Archives: djgpp/1998/08/14/03:00:28
On 12/08/98 bowman wrote:
>Robin Pell wrote:
>>
>> win.cpp: In function `int main()':
>> win.cpp:5: `CursesWindow' undeclared (first use this function)
>what comes before CursesWindow?
Nothing in my code... those few lines were the entire source.
>I assume it is some sort of user defined type such as WINDOW CursesWindow.
Yes. The CursesWindow class is a set of C++ wrappers for the C curses
functions in curses.h.
>If the declaration is there, then the
>header file defining the type is not getting picked up. I don't see a
>curses header in the verbose output.
I think that Elii in his second post has given the reason why that is:
_G_config.h is undefining the curses that CursesWindow relies upon.
Thanks for pointing that out, though, as I hadn't noticed it myself.
>I've been trying to get DFlat up, and in the course of that have found
>another obscure thing that will get you the same error. While you can
>declare variables at the start of a block, they must be physically at
>the start. so,
>......
>else
>{
> int someVar = x * y;
>works. but sticking in a debugging statement,
>else
>{
> printf("x = %x\n", x);
> int someVar = x * y;
>will break it and get the undeclared variable error for someVar;
This is true in C - all variables have to be declared at the start of
a code block. In C++, however, variables/objects can be declared
anywhere in the code.
>I'm not a language lawyer, but I think this may be a misfeature.
Neither am I, and I quite get your point. Maybe that's why it was
changed for C++?
Thanks again for your time and comments.
rob.
- Raw text -