delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/14/03:00:28

From: robin AT redwing DOT force9 DOT co DOT uk (Robin Pell)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Problem using CursesWindow class
Date: Fri, 14 Aug 1998 06:15:46 GMT
Organization: Force 9 Internet
Lines: 55
Message-ID: <35d3d370.225558@news.force9.net>
References: <35ce0e92 DOT 55072 AT news DOT force9 DOT net>
NNTP-Posting-Host: 195.166.132.62
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019