Solved

CWindowImpl problem - URGENT

Posted on 2001-06-13
6
390 Views
Last Modified: 2010-08-05
Hi, I'm trying to implement CWindowImpl on my class CMenus, here is a simplified declaration:

CMenus: ..., public CWindowImpl<CMenus> {
BEGIN_MSG_MAP(CMenus)
  MESSAGE_HANDLER(WM_MEASUREITEM, OnMeasureItem)
END_MSG_MAP

LRESULT OnMeasureItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
  // TODO : Add Code for message handler. Call    
     DefWindowProc if necessary.
  return 0;
}

This code gives me the error "fatal error C1075: end of file found before the left brace '{' at 'c:\dev\menus\menus.h(28)' was matched"

menus.h(28) is the line
BEGIN_MSG_MAP(CMenus)

What am I doing wrong here? If I don't get this right ASAP, I'm going to have to implement subclassing myself, and I'd rather use the ATL implementation.
0
Comment
Question by:shederman
6 Comments
 

Expert Comment

by:NickAtBOM
ID: 6184972
The code you have posted here needs an additional right brace on the last line - you open braces for the class definition on line 1 but never close again.  

If this is not the correct answer, can you post the full code?
0
 

Expert Comment

by:SusanneJost
ID: 6188677
Nick is absolutely right
0
 
LVL 22

Expert Comment

by:ambience
ID: 6189479
menus.h(28) is the line
BEGIN_MSG_MAP(CMenus)

>>> Something has gone wrong before that line , it can't be the right brace that you are missing on the last line in the post.

C1075: The compiler expected to find a matching brace before it reached the end of your source file but was unable to. Check whether your open brackets (and other paired characters such as curly braces) match with close brackets.

0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:shederman
ID: 6189653
I don't think the problem is actually unmatched braces. If I take out the CWindomImpl<CMenus> inheritance, and remove the MSG_MAP the program compiles perfectly.
0
 

Accepted Solution

by:
NickAtBOM earned 200 total points
ID: 6189846
Just spotted another typo.  Try putting

END_MSG_MAP()  // i.e. with brackets

If it is not the brace at the end of the class, then it suggests that one of the two braces opened by the BEGIN_MSG_MAP(class) macro have not been closed.
0
 

Author Comment

by:shederman
ID: 6189889
Bloody hell, I feel like an idiot. Thanks!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question