--------------------Configuration: MyVC83 - Win32 Debug--------------------
Compiling...
MyVC83View.cpp
E:\C++\MyVC83\MyVC83View.cpp(108) : error C2065: 'CAdodlg' : undeclared identifier
E:\C++\MyVC83\MyVC83View.cpp(108) : error C2146: syntax error : missing ';' before identifier 'dlg'
E:\C++\MyVC83\MyVC83View.cpp(108) : error C2065: 'dlg' : undeclared identifier
E:\C++\MyVC83\MyVC83View.cpp(109) : error C2228: left of '.DoModal' must have class/struct/union type
执行 cl.exe 时出错.MyVC83View.obj - 1 error(s), 0 warning(s)
// MyVC83View.cpp : implementation of the CMyVC83View class
//
#include "adodlg.h"
#include "stdafx.h"
#include "MyVC83.h"#include "MyVC83Doc.h"
#include "MyVC83View.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/////////////////////////////////////////////////////////////////////////////
// CMyVC83ViewIMPLEMENT_DYNCREATE(CMyVC83View, CView)BEGIN_MESSAGE_MAP(CMyVC83View, CView)
//{{AFX_MSG_MAP(CMyVC83View)
ON_COMMAND(ID_ADO_ACTIVEX, OnAdoActivex)
ON_COMMAND(ID_ADO_DLL, OnAdoDll)
//}}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()/////////////////////////////////////////////////////////////////////////////
// CMyVC83View construction/destructionCMyVC83View::CMyVC83View()
{
// TODO: add construction code here}CMyVC83View::~CMyVC83View()
{
}BOOL CMyVC83View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs return CView::PreCreateWindow(cs);
}/////////////////////////////////////////////////////////////////////////////
// CMyVC83View drawingvoid CMyVC83View::OnDraw(CDC* pDC)
{
CMyVC83Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}/////////////////////////////////////////////////////////////////////////////
// CMyVC83View printingBOOL CMyVC83View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}void CMyVC83View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}void CMyVC83View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}/////////////////////////////////////////////////////////////////////////////
// CMyVC83View diagnostics#ifdef _DEBUG
void CMyVC83View::AssertValid() const
{
CView::AssertValid();
}void CMyVC83View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}CMyVC83Doc* CMyVC83View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMyVC83Doc)));
return (CMyVC83Doc*)m_pDocument;
}
#endif //_DEBUG/////////////////////////////////////////////////////////////////////////////
// CMyVC83View message handlersvoid CMyVC83View::OnAdoActivex()
{
CAdodlg dlg;
dlg.DoModal();
}void CMyVC83View::OnAdoDll()
{
// TODO: Add your command handler code here
}
Compiling...
MyVC83View.cpp
E:\C++\MyVC83\MyVC83View.cpp(108) : error C2065: 'CAdodlg' : undeclared identifier
E:\C++\MyVC83\MyVC83View.cpp(108) : error C2146: syntax error : missing ';' before identifier 'dlg'
E:\C++\MyVC83\MyVC83View.cpp(108) : error C2065: 'dlg' : undeclared identifier
E:\C++\MyVC83\MyVC83View.cpp(109) : error C2228: left of '.DoModal' must have class/struct/union type
执行 cl.exe 时出错.MyVC83View.obj - 1 error(s), 0 warning(s)
// MyVC83View.cpp : implementation of the CMyVC83View class
//
#include "adodlg.h"
#include "stdafx.h"
#include "MyVC83.h"#include "MyVC83Doc.h"
#include "MyVC83View.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/////////////////////////////////////////////////////////////////////////////
// CMyVC83ViewIMPLEMENT_DYNCREATE(CMyVC83View, CView)BEGIN_MESSAGE_MAP(CMyVC83View, CView)
//{{AFX_MSG_MAP(CMyVC83View)
ON_COMMAND(ID_ADO_ACTIVEX, OnAdoActivex)
ON_COMMAND(ID_ADO_DLL, OnAdoDll)
//}}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()/////////////////////////////////////////////////////////////////////////////
// CMyVC83View construction/destructionCMyVC83View::CMyVC83View()
{
// TODO: add construction code here}CMyVC83View::~CMyVC83View()
{
}BOOL CMyVC83View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs return CView::PreCreateWindow(cs);
}/////////////////////////////////////////////////////////////////////////////
// CMyVC83View drawingvoid CMyVC83View::OnDraw(CDC* pDC)
{
CMyVC83Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}/////////////////////////////////////////////////////////////////////////////
// CMyVC83View printingBOOL CMyVC83View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}void CMyVC83View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}void CMyVC83View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}/////////////////////////////////////////////////////////////////////////////
// CMyVC83View diagnostics#ifdef _DEBUG
void CMyVC83View::AssertValid() const
{
CView::AssertValid();
}void CMyVC83View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}CMyVC83Doc* CMyVC83View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMyVC83Doc)));
return (CMyVC83Doc*)m_pDocument;
}
#endif //_DEBUG/////////////////////////////////////////////////////////////////////////////
// CMyVC83View message handlersvoid CMyVC83View::OnAdoActivex()
{
CAdodlg dlg;
dlg.DoModal();
}void CMyVC83View::OnAdoDll()
{
// TODO: Add your command handler code here
}
解决方案 »
- [Help]如何把指定目录下所有文件名保存到一个txt文件中?
- 关于Windows服务的怪事,急!
- 往txt里面写入一些信息后,想要提取出里面的内容,应该如何提取?内容有详细描述
- 求救:安装vc6.0最后的时候出现 安装程序无法创建一个DCOM用户帐号来注册
- COM中套间线程间数据同步的问题
- 哪位GG来帮个忙,98下start=3的wdm的驱动怎么启动它,还有怎么不用inf,而用使用程序安装???
- 现在这种环境下,我们是否应该全力地去学好面向对象呢?
- 如何UnhookWindowsHookEx其它进程安装的钩子?
- 这么检测内存泄漏,可以吗?
- micrack又提问了~~~~~~~50分
- 非模态对话框中的OnTimer问题
- 继承CDialog的类重载DoModal中 多次调用父类CDialog的DoModal有问题(VS05)
//
#include "stdafx.h"
#include "adodlg.h"
#include "stdafx.h" 顺序错了
VC默认"stdafx.h" 头文件之前的任何代码都不会参与编译的
比如
165151321321
#include "stdafx.h"
也没有错
// MyVC83View.cpp : implementation of the CMyVC83View class
//
#include "stdafx.h"
#include "adodlg.h" 还是出现错误:
--------------------Configuration: MyVC83 - Win32 Debug--------------------
Compiling...
MyVC83View.cpp
e:\c++\myvc83\adodlg.h(21) : error C2065: 'IDD_DIALOG1' : undeclared identifier
e:\c++\myvc83\adodlg.h(21) : error C2057: expected constant expression
执行 cl.exe 时出错.MyVC83View.obj - 1 error(s), 0 warning(s)
下面是报错误地方:#if !defined(AFX_ADODLG_H__0267EB07_5076_4D32_B3CC_58B10AB65F42__INCLUDED_)
#define AFX_ADODLG_H__0267EB07_5076_4D32_B3CC_58B10AB65F42__INCLUDED_#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Adodlg.h : header file
///////////////////////////////////////////////////////////////////////////////
// CAdodlg dialogclass CAdodlg : public CDialog
{
// Construction
public:
CAdodlg(CWnd* pParent = NULL); // standard constructor // Dialog Data
// {{AFX_DATA(CAdodlg)
enum { IDD = IDD_DIALOG1 }; ////////////////报错地方!
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAdodlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL// Implementation
protected: // Generated message map functions
//{{AFX_MSG(CAdodlg)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_ADODLG_H__0267EB07_5076_4D32_B3CC_58B10AB65F42__INCLUDED_)
#include "MyVC83.h" ...
#include "adodlg.h"
#include "stdafx.h"
#include "stdafx.h" #include "adodlg.h"
#include "adodlg.h"
#include "resource.h"试一下还会不会出现错误