我已经
#include <stdio.h>
#include <winsock.h>
#include <afx.h>
#include <string.h>
但编译报错:
c:\program files\microsoft visual studio\vc98\mfc\include\afxv_w32.h(14) : fatal error C1189: #error :  WINDOWS.H already included.  MFC apps must not #include <windows.h>

解决方案 »

  1.   

    加上#include <afxwin.h>
    project->settings->general->microsoft foundation classes下
    要选use MFC in a shared Dll
      

  2.   

    要包含头文件 afxwin.h 即:
    #include <afxwin.h>还要更改一下项目设置,Project -> Settings 在 C/C++ 面,在 Category 下拉框选择 CodeGeneration ,然后在 Use run-time library 选择 Debug Multithread ( debug 版)或者选择 Multithreaded (编译 release 版本程序时用)
      

  3.   

    李逍遥的做法不错,另外,Console工程在新建的时候可以选择MFC支持,这样的话就不用上面的步骤了至于你的错误很容易解决#include <afx.h>放在其他#include的前面就可以了,我记得使用CString是不需要MFC支持的
      

  4.   

    oh,sorry
    弄混了
    同意sgnaw(李逍遥)