请教高手:
正在学习MFC,抄了一个简单的压键盘程序如下:红色部分是俺添加的,其他都是VC自己生成的,在编译时,出现如下一个错误,找不到文件 'Debug/Ch5Demo1.pch',原因可能是在哪里?Compiling...
Ch5Demo1View.cpp
c:\program files\microsoft visual studio\myprojects\ch5demo1\ch5demo1view.cpp(4) : fatal error C1083: Cannot open precompiled header file: 'Debug/Ch5Demo1.pch': No such file or directory
Error executing cl.exe.
// Ch5Demo1View.cpp : implementation of the CCh5Demo1View class
//#include "stdafx.h"
#include "Ch5Demo1.h"#include "Ch5Demo1Doc.h"
#include "Ch5Demo1View.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/////////////////////////////////////////////////////////////////////////////
// CCh5Demo1ViewIMPLEMENT_DYNCREATE(CCh5Demo1View, CView)BEGIN_MESSAGE_MAP(CCh5Demo1View, CView)
//{{AFX_MSG_MAP(CCh5Demo1View)
ON_WM_KEYDOWN()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CCh5Demo1View construction/destructionCCh5Demo1View::CCh5Demo1View()
{
// TODO: add construction code here}CCh5Demo1View::~CCh5Demo1View()
{
}BOOL CCh5Demo1View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs return CView::PreCreateWindow(cs);
}/////////////////////////////////////////////////////////////////////////////
// CCh5Demo1View drawingvoid CCh5Demo1View::OnDraw(CDC* pDC)
{
CCh5Demo1Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}/////////////////////////////////////////////////////////////////////////////
// CCh5Demo1View printingBOOL CCh5Demo1View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}void CCh5Demo1View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}void CCh5Demo1View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}/////////////////////////////////////////////////////////////////////////////
// CCh5Demo1View diagnostics#ifdef _DEBUG
void CCh5Demo1View::AssertValid() const
{
CView::AssertValid();
}void CCh5Demo1View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}CCh5Demo1Doc* CCh5Demo1View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCh5Demo1Doc)));
return (CCh5Demo1Doc*)m_pDocument;
}
#endif //_DEBUG/////////////////////////////////////////////////////////////////////////////
// CCh5Demo1View message handlersvoid CCh5Demo1View::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
AfxMessageBox("用户按下了键!") ; //弹出提示对话框 CView::OnKeyDown(nChar, nRepCnt, nFlags);
}
正在学习MFC,抄了一个简单的压键盘程序如下:红色部分是俺添加的,其他都是VC自己生成的,在编译时,出现如下一个错误,找不到文件 'Debug/Ch5Demo1.pch',原因可能是在哪里?Compiling...
Ch5Demo1View.cpp
c:\program files\microsoft visual studio\myprojects\ch5demo1\ch5demo1view.cpp(4) : fatal error C1083: Cannot open precompiled header file: 'Debug/Ch5Demo1.pch': No such file or directory
Error executing cl.exe.
// Ch5Demo1View.cpp : implementation of the CCh5Demo1View class
//#include "stdafx.h"
#include "Ch5Demo1.h"#include "Ch5Demo1Doc.h"
#include "Ch5Demo1View.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/////////////////////////////////////////////////////////////////////////////
// CCh5Demo1ViewIMPLEMENT_DYNCREATE(CCh5Demo1View, CView)BEGIN_MESSAGE_MAP(CCh5Demo1View, CView)
//{{AFX_MSG_MAP(CCh5Demo1View)
ON_WM_KEYDOWN()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CCh5Demo1View construction/destructionCCh5Demo1View::CCh5Demo1View()
{
// TODO: add construction code here}CCh5Demo1View::~CCh5Demo1View()
{
}BOOL CCh5Demo1View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs return CView::PreCreateWindow(cs);
}/////////////////////////////////////////////////////////////////////////////
// CCh5Demo1View drawingvoid CCh5Demo1View::OnDraw(CDC* pDC)
{
CCh5Demo1Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}/////////////////////////////////////////////////////////////////////////////
// CCh5Demo1View printingBOOL CCh5Demo1View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}void CCh5Demo1View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}void CCh5Demo1View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}/////////////////////////////////////////////////////////////////////////////
// CCh5Demo1View diagnostics#ifdef _DEBUG
void CCh5Demo1View::AssertValid() const
{
CView::AssertValid();
}void CCh5Demo1View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}CCh5Demo1Doc* CCh5Demo1View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCh5Demo1Doc)));
return (CCh5Demo1Doc*)m_pDocument;
}
#endif //_DEBUG/////////////////////////////////////////////////////////////////////////////
// CCh5Demo1View message handlersvoid CCh5Demo1View::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
AfxMessageBox("用户按下了键!") ; //弹出提示对话框 CView::OnKeyDown(nChar, nRepCnt, nFlags);
}
解决方案 »
- error 'string' : undeclared identifier
- 如何把数个图标写入DLL文件?
- 利用vc如何取得word文档中多个表格中的第二个?
- 如下代码什么含义
- BSTR 怎么转换成 std::wstring
- 如何调用win2000下“程序-附件-图像处理”应用程序中“文件--获取图像”打开的那个“USB PC Camera 301P”摄像程序?
- 我想在无模式对话框关闭的时候释放对话框内存,应该在相应那个消息?
- 如何获取QQ空间说说列表
- 求回复啊,这个程序该怎么设计。都进来看看呗
- 怎样在基于对话框的应用程序中使用CScrollView,请高手指教
- CChart 2.0.5.1版
- 基于TCP的服务器端程序出错求助
把工程目录下的pch、obj、debug文件夹都删掉然后重新编译下