小弟vc入门,照书抄一个例子,一步一步都和书上一样,可是build的时候239个错误。我要抓狂了。
都是很莫名奇妙的错误:
syntax error : missing ';' before '}'
use of undefined type 'CEx07aView'
等等,可是怎么可能啊?
compile的时候说×××.h不能编译,no compile tool
怎么回事啊?
在线等,多谢
都是很莫名奇妙的错误:
syntax error : missing ';' before '}'
use of undefined type 'CEx07aView'
等等,可是怎么可能啊?
compile的时候说×××.h不能编译,no compile tool
怎么回事啊?
在线等,多谢
说明你抄书时候出错了,比如这个在}前少了;号,每个语句后都要加分号的
//#include "stdafx.h"
#include "Ex07a.h"#include "Ex07aDoc.h"
#include "Ex07aView.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/////////////////////////////////////////////////////////////////////////////
// CEx07aViewIMPLEMENT_DYNCREATE(CEx07aView, CFormView)BEGIN_MESSAGE_MAP(CEx07aView, CFormView)
//{{AFX_MSG_MAP(CEx07aView)
ON_BN_CLICKED(IDC_NEXT, OnNextRecord)
ON_BN_CLICKED(IDC_ADD, OnAddRecord)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CFormView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CFormView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CFormView::OnFilePrintPreview)
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CEx07aView construction/destructionCEx07aView::CEx07aView()
: CFormView(CEx07aView::IDD)
{
//{{AFX_DATA_INIT(CEx07aView)
m_lCode = 0;
m_sName = _T("");
m_lAge = 0;
m_lScore = 0.0;
//}}AFX_DATA_INIT
// TODO: add construction code here}CEx07aView::~CEx07aView()
{
}void CEx07aView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CEx07aView)
DDX_Text(pDX, IDC_CODE, m_lCode);
DDX_Text(pDX, IDC_NAME, m_sName);
DDX_Text(pDX, IDC_AGE, m_lAge);
DDX_Text(pDX, IDC_SCORE, m_lScore);
//}}AFX_DATA_MAP
}BOOL CEx07aView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs return CFormView::PreCreateWindow(cs);
}void CEx07aView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
ResizeParentToFit();}/////////////////////////////////////////////////////////////////////////////
// CEx07aView printingBOOL CEx07aView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}void CEx07aView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}void CEx07aView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}void CEx07aView::OnPrint(CDC* pDC, CPrintInfo* /*pInfo*/)
{
// TODO: add customized printing code here
}/////////////////////////////////////////////////////////////////////////////
// CEx07aView diagnostics#ifdef _DEBUG
void CEx07aView::AssertValid() const
{
CFormView::AssertValid();
}void CEx07aView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}CEx07aDoc* CEx07aView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEx07aDoc)));
return (CEx07aDoc*)m_pDocument;
}
#endif //_DEBUG/////////////////////////////////////////////////////////////////////////////
// CEx07aView message handlers//void CEx07aView::OnNextRecord()
//{
// TODO: Add your control notification handler code here
// CEx07aDoc * pDoc=GetDocument();
// ASSERT_VALID(pDoc);// if(pDoc->curPos!=NULL)
// {
//CStudent *pStudent=pDoc->m_dataList.GetAt(pDoc->curPos);
// m_lCode=pStudent->m_lCode;
// m_sName=pStudent->m_sName;
// m_lAge=pStudent->m_lAge;
// m_lScore=pStudent->m_lScore;// UpdateData(false);// pDoc->m_dataList.GetNext(pDoc->curPos);
// if (pDoc->curPos==NULL)
// pDoc->curPos=pDoc->m_dataList.GetHeadPosition();
// }
// else
// MessageBox("There is no data!");
//}//void CEx07aView::OnAddRecord()
//{
// TODO: Add your control notification handler code here
// UpdateData();// CEx07aDoc *pDoc=GetDocument();
// ASSERT_VALID(pDoc);// CStudent *pStudent;
// pStudent= new CStudent(m_lCode,m_sName,m_lAge,m_lScore);//ÓÃÓû§ÊäÈëµÄ±äÁ¿Öµ¹¹ÔìÒ»¸öÐÂCStudent¶ÔÏó
//pDoc->m_dataList.AddTail(pStudent);//È»ºó½«Æä¼ÓÈëm_dataList±íβ
//pDoc->curPos=pDoc->m_dataList.GetHeadPosition();//×îºó½«curPos Ö¸Ïò±íÍ·
//}