首先,这肯定是能够做到的你做了下面的设置没有?
project/setting/General/
把not using mfc改为usimg mfc in a shared dll

解决方案 »

  1.   

    http://www.csdn.net/expert/topic/710/710822.xml?temp=.3868524
      

  2.   

    你上面的程序是一个windows console 程序,这样的程序,你就不要包含windows.h了
    下面代码调试通过#include "iostream.h"
    #include "afx.h"int main() {

    CString astring("i love you");
    cout<<astring<<endl;
        return 0;
    } 别忘了
    你做了下面的设置没有?
    project/setting/General/
    把not using mfc改为usimg mfc in a shared dll
      

  3.   

    首先,在文件中加入如下语句: 
    #include <afx.h>
    #include <afxwin.h>         // MFC core and standard components
    #include <afxext.h>         // MFC extensions
    在WinMain()的开始加入
    if (!AfxWinInit(hInstance, NULL, lpCmdLine, 0))
    {
    // TODO: change error code to suit your needs
    MessageBox(NULL,"Can't !","Error!",MB_OK);
    }
    然后在project->setting->general中设置USE MFC IN A SHARE DLL or use mfc in a static library (无所谓,任一都不影响)。
    在project->setting->link->object/library module中加入kernel32.lib user32.lib gdi32.lib (这是关键,你所说的链接错误就是因为没有加这些库文件所致)一切OK,然后你就可以用MFC类了。