--------------------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

}

解决方案 »

  1.   

    把你的头文件"adodlg.h"添加到MyVC83View.cpp中
      

  2.   

    // MyVC83View.cpp : implementation of the CMyVC83View class 
    // 
    #include "stdafx.h" 
    #include "adodlg.h" 
      

  3.   

    #include "adodlg.h"
    #include "stdafx.h" 顺序错了
    VC默认"stdafx.h" 头文件之前的任何代码都不会参与编译的
    比如
    165151321321
    #include "stdafx.h" 
    也没有错
      

  4.   

    改为如下
    // 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_)
      

  5.   

    #include "stdafx.h" 
    #include "MyVC83.h" ...
    #include "adodlg.h" 
      

  6.   

    #include "adodlg.h"
    #include "stdafx.h" 
      

  7.   


    #include "stdafx.h" #include "adodlg.h"
      

  8.   

    #include "stdafx.h"
    #include "adodlg.h"
    #include "resource.h"试一下还会不会出现错误