好心人给讲讲这七个错误的原因,解决方法,需要那些参考资料--------------------Configuration: TNO62 - Win32 Debug--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
TNO62.cpp
1: error C2146: syntax error : missing ';' before identifier 'm_YellowEdit'
2: error C2501: 'CYelloEdit' : missing storage-class or type specifiers
3: error C2501: 'm_YellowEdit' : missing storage-class or type specifiers
TNO62Dlg.cpp
4: error C2146: syntax error : missing ';' before identifier 'm_YellowEdit'
5: error C2501: 'CYelloEdit' : missing storage-class or type specifiers
6: error C2501: 'm_YellowEdit' : missing storage-class or type specifiers
7: error C2065: 'm_YellowEdit' : undeclared identifier
YelloEdit.cpp
Generating Code...
Error executing cl.exe.TNO62.exe - 7 error(s), 0 warning(s)前六个错误都指向这里://{{AFX_DATA(CTNO62Dlg)
enum { IDD = IDD_TNO62_DIALOG };
CYelloEdit m_YellowEdit;
//}}AFX_DATA这个m_YellowEdit,我按照MSDN的要求定义为(Control)CYellowEdit类型,这个CYellowEdit从CEdit继承最后一个错误指向这里:CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTNO62Dlg)
DDX_Control(pDX, IDC_EDIT1, m_YellowEdit);
//}}AFX_DATA_MAP
}按照MSDN的要求,先在Dialog Box上画一个edit,然后设置其变量为Control 并且为CYellowEdit类型令问:  ON_WM_CTLCOLOR_REFLECT() 干吗的?附MSDN的示例To try the example that creates a reusable control
Create a new dialog box in an existing application. For more information, see the dialog editor topic. You must have an application in which to develop the reusable control. If you don't have an existing application to use, create a dialog-based application using AppWizard. With your project loaded into Visual C++, use ClassWizard to create a new class called CYellowEdit based on CEdit.Add three member variables to your CYellowEdit class. The first two will be COLORREF variables to hold the text color and the background color. The third will be a CBrush object that will hold the brush for painting the background. The CBrush object allows you to create the brush once, merely referencing it after that, and to destroy the brush automatically when the CYellowEdit control is destroyed.Initialize the member variables by writing the constructor as follows:   Copy Code 
CYellowEdit::CYellowEdit()
{
   m_clrText = RGB( 0, 0, 0 );
   m_clrBkgnd = RGB( 255, 255, 0 );
   m_brBkgnd.CreateSolidBrush( m_clrBkgnd );
}
 Using ClassWizard, add a handler for the reflected WM_CTLCOLOR message to your CYellowEdit class. Note that the equal sign in front of the message name in the list of messages you can handle indicates that the message is reflected. This is described in Defining a Message Handler for a Reflected Message. ClassWizard adds the following message-map macro and skeleton function for you:   Copy Code 
ON_WM_CTLCOLOR_REFLECT()// Note: other code will be in between....HBRUSH CYellowEdit::CtlColor(CDC* pDC, UINT nCtlColor) 
{
   // TODO: Change any attributes of the DC here
   
   // TODO: Return a non-NULL brush if the
   //   parent's handler should not be called
   return NULL;
}
 Replace the body of the function with the following code. The code specifies the text color, the text background color, and the background color for rest of the control.   Copy Code 
   pDC->SetTextColor( m_clrText );   // text
   pDC->SetBkColor( m_clrBkgnd );   // text bkgnd
   return m_brBkgnd;            // ctl bkgnd
 Create an edit control in your dialog box, then attach it to a member variable by double-clicking the edit control while holding a control key down. In the Add Member Variable dialog box, finish the variable name and choose "Control" for the category, then "CYellowEdit" for the variable type. Don't forget to set the tab order in the dialog box. Also, be sure to include the header file for the CYellowEdit control in your dialog box's header file.Build and run your application. The edit control will have a yellow background.感激不尽啦~~~~~~~~~~~~~~~~~~~~~~~~~~~ 只剩20分了

解决方案 »

  1.   

    要包含含有类CYellowEdit的头文件
      

  2.   

    没有找到CYelloEdit的定义,你没有包含头文件看看有没有"Cyelloedit.h"这样的文件
      

  3.   

    包含头文件之后又出俩这样的:--------------------Configuration: TNO62 - Win32 Debug--------------------
    Compiling...
    TNO62.cpp
    d:\myfiles\projects\tno62\tno62dlg.h(11) : fatal error C1083: Cannot open include file: 'CYellowEdit.h': No such file or directory
    TNO62Dlg.cpp
    d:\myfiles\projects\tno62\tno62dlg.h(11) : fatal error C1083: Cannot open include file: 'CYellowEdit.h': No such file or directory
    Generating Code...
    Error executing cl.exe.TNO62.exe - 2 error(s), 0 warning(s)这样的No such file or directory 我经常出现,CYellowEdit.h 明明在工程目录下,一直不知道怎么解决
      

  4.   

    CYellowEdit.h文件是否以近添加到工程文件中?