在我的main函数里使用 cstrng,为什么编译时说未声明啊?我已经包含头文件了啊#include"iostream.h"
#include"stdio.h"
#include"stdlib.h"

解决方案 »

  1.   

    #include   <afx.h> 
      

  2.   

    如果在非MFC 的程序里用CString ,需要包含CString 所在的头文件 afx.h,在你的程序最开始那里增加:#include <afx.h>然后,还要在IDE 菜单里选择:project->setting,选择 general 选项页,在foundation class 那个下拉框选择 Use MFC  in a shared DLL,  再 rebuild all ,应可以了。
      

  3.   

    一定要选择  Use MFC in a shared  ,否则,编译时出错:nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
    nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
      

  4.   

    需要包含MFC的头文件
    #include <afx.h>建立MFC工程时,编译器会帮你自动添加,不是MFC工程就需要自己手动