Jump to content

  • Log In with Google      Sign In   
  • Create Account

RECT Beginner Problem


Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
5 replies to this topic

#1 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 23 September 1999 - 09:13 AM

Here's what I've wrote :

RECT rect1 , rect2 , rect3 , rect4 , rect5 ;

line (21) rect1.left=4615;
rect1.top=3885;
rect1.right=28385;
rect1.bottom=12115;

And here what the Compiler says :
check.cpp(21) : error C2501: 'rect1' : Missing Declaration
check.cpp(21) : error C2371: 'rect1' : Newdefinition ; different Basis Types
check.cpp(21) : error C2239: Unexpected Token '.' after Declaration of 'rect1'
check.cpp(21) : error C2059: Syntax Error : '.'

I've included all important header files!


#2 Dave Astle   Distinguished Rhino   -  Reputation: 2311

Like
Likes
Like

Posted 23 September 1999 - 03:36 AM

Hmmm... that looks fine, and I tried compiling it and had no errors. Is there something before the RECT that may be causing the compiler to not translate it correctly?

#3 MikeD   Members   -  Reputation: 158

Like
Likes
Like

Posted 23 September 1999 - 05:13 AM

It would help if you showed us your decleration of RECT.

#4 Sphet   Members   -  Reputation: 631

Like
Likes
Like

Posted 23 September 1999 - 08:18 AM

My guess is that you arn't declaring the structure of RECT. It is part of the MFC headers in Visual C++, so if your project isn't including MFC, and you arn't explictly including any of the headers, then you will have to define it yourself. This isn't hard. The structure can be found in the help files:

typedef struct tagRECT {
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECT;



#5 Dave Astle   Distinguished Rhino   -  Reputation: 2311

Like
Likes
Like

Posted 23 September 1999 - 09:00 AM

RECT is defined in windef.h which is automatically included if you include windows.h. So if it's a Windows app, regardless of the flavor, RECT is defined. Since he said he included all the appropriate headers, I'm guessing that windows.h was one of them.

If it's not a Windows program,, of course RECT would have to be defined.


#6 Dave Astle   Distinguished Rhino   -  Reputation: 2311

Like
Likes
Like

Posted 23 September 1999 - 09:13 AM

Ahhhh! Where is the code you gave us located? Is it outside of any function body? (I'm pretty sure it is). If so, that's your problem. You can declare a RECT (or any struct) globally, but you can't assign its members outside of a function body.




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.




PARTNERS