库文件 nafxcwd.lib 没找到或者没有#include 近来需要的头文件巴

解决方案 »

  1.   

    #include "afxwin.h"class CMyApp : public CWinApp
    {
    public:
    virtual BOOL InitInstance();
    };class CMainFrame : public CFrameWnd
    {
        CMyApp myapp;
    };BOOL CMyApp::InitInstance()
    {
    m_pMainWnd=new CMainFrame;
    ((CMainFrame*)m_pMainWnd)->Create(NULL,"Keenu's Window");
    m_pMainWnd->ShowWindow(m_nCmdShow);
    return 1;
    }我的原代码。
      

  2.   

    这个工程是不是自己创建的,可能是Project settings没设置好,因为有一种情况是自己手工创建的工程,使用了MFC,但却没有在工程中设置使用MFC。如果不是,试一下下面的语句
    #pragma comment(linker, "/disallowlib:nafxcwd.lib")
      

  3.   

    看了你的代码,我估计是我提到的第一种情形,菜单:Project->Settings...->General Tab。
      

  4.   

    在Project Settings里得Link下面Object/Libary Modules把库文件nafxcwd.lib加进来
      

  5.   

    在Project->Setting->General中的Microsoft Foundation Classes中选
    Use MFC in a Static Library 或 Use MFC in a Shared DLL,即可。 
      

  6.   

    在Project->Setting->General中的Microsoft Foundation Classes中选
    Use MFC in a Static Library 或 Use MFC in a Shared DLL,即可。 我试了,这下可以了,编译通过了,但是:更坏的是:谈出一个对话框:[Ox5f43351b]指令的{0x000000000]内存,不能为readfaint!!!!!!!!!!!!!!!!by the way,为什么?我的程序很简单,为什么也要用到MFC呢?
    #include "afxwin.h"class CMyApp : public CWinApp
    {
    public:
        virtual BOOL InitInstance();
    };class CMainFrame : public CFrameWnd
    {
        CMyApp myapp;
    };BOOL CMyApp::InitInstance()
    {
        m_pMainWnd=new CMainFrame;
        ((CMainFrame*)m_pMainWnd)->Create(NULL,"Keenu's Window");
        m_pMainWnd->ShowWindow(m_nCmdShow);
        return 1;
    }
      

  7.   

    去掉CMyApp myapp;
    在外面定义全局变量:
    CMyApp myapp;
      

  8.   

    为什么?一定要把MFC加进来呢。