我把一个文件添加到工程中以后,结果就提示这个错误,
(这个文件在创建他的工程中是可以使用的 .cpp 和相应的 .h文件)
是不是要进行什么设置?

解决方案 »

  1.   

    我在一个空工程里面加入如下两个文件
    错误提示:fatal error C1083: Cannot open include file: 'hello.h': No such file or directoryHello.h
    class CMyApp : public CWinApp
    {
    public:
        virtual BOOL InitInstance ();
    };class CMainWindow : public CFrameWnd
    {
    public:
        CMainWindow ();protected:
        afx_msg void OnPaint ();
        DECLARE_MESSAGE_MAP ()
    };Hello.cpp
    #include <afxwin.h>
    #include "Hello.h"CMyApp myApp;/////////////////////////////////////////////////////////////////////////
    // CMyApp member functionsBOOL CMyApp::InitInstance ()
    {
        m_pMainWnd = new CMainWindow;
       m_pMainWnd->ShowWindow (m_nCmdShow);
        m_pMainWnd->UpdateWindow ();
        return TRUE;
    }/////////////////////////////////////////////////////////////////////////
    // CMainWindow message map and member functionsBEGIN_MESSAGE_MAP (CMainWindow, CFrameWnd)
        ON_WM_PAINT ()
    END_MESSAGE_MAP ()CMainWindow::CMainWindow ()
    {
        Create (NULL, _T ("The Hello Application"));
    }void CMainWindow::OnPaint ()
    {
        CPaintDC dc (this);
        
        CRect rect;
        GetClientRect (&rect);    dc.DrawText (_T ("Hello, MFC"), -1, &rect,
            DT_SINGLELINE &brvbar; DT_CENTER &brvbar; DT_VCENTER);
    }