我在一个类里面要用CString类.我引了头文件#include "afx.h".为什么总是出错fatal error C1189: #error :  WINDOWS.H already included.  MFC apps must not #include <windows.h>
我怎么解决啊?

解决方案 »

  1.   

    CString的头文件是:atlstr.h,(非MFC应用程序引用).
    afx.h包含太多了.造成了重复引用.
      

  2.   

    #ifdef  "afx.h"???
    还是有错:fatal error C1016: #if[n]def expected an identifier
      

  3.   

    我加了#include "atlstr.h"有错:fatal error C1083: Cannot open include file: 'atlstr.h': No such file or directory我到哪里去找'atlstr.h'
      

  4.   

    工程目录里 include下#include <atlstr.h>
    指定在include目录下查找
    #include "atlstr.h"
    先在当前目录下查找,找不到再找include目录应该不可能找不到此头文件的
      

  5.   

    别说,我的电脑上还真找不到 atlstr.h 。
    ATL的?
      

  6.   

    你把windows.h去掉看可以不,MFC好象包含这个头文件了吧,最好把这个头文件放到最底下
      

  7.   

    没有atlstr.h这个头文件.
    我的电脑里位置是D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include,我装在D盘的.
      

  8.   

    我在整个硬盘上搜,也搜不到atlstr.h
    我现在怎么处理啊?
    我的工程是non-MFC的