在vc++6.0环境下,单独编译资源文件(resource files)
我通常会在文件中加入 #include "stdafx.h"
编译时,经常出现下面的错误
Cannot open precompiled header file: 'Debug/rectangle.pch': No such file or directory
为什么?

解决方案 »

  1.   

    为什么好多人的vc++6.0都要加#include "stdafx.h"
    而我的不要,我从网上当的源码中也会有这个头文件,可我编译时从来就没有通过过!!晕
    这是怎么回事?
      

  2.   

    如果你使用MFC就最好使用stdafx.h,请参考MSDN的说明
    Stdafx.h,Stdafx.cpp:These files are used to build a precompiled header file Projname.pch and a precompiled types file Stdafx.obj.
    These files are located in the Projname directory. In Solution Explorer, Stdafx.h is in the Header Files folder, and Stdafx.cpp is located in the Source Files folder.Stdafx.h
    An include file for standard system include files and for project-specific include files that are used frequently but are changed infrequently. 
    You should not define or undefine any of the _AFX_NO_XXX macros in stdafx.h; see the Knowledge Base article "PRB: Problems Occur When Defining _AFX_NO_XXX". You can find Knowledge Base articles in the MSDN Library or at http://search.support.microsoft.com/.Stdafx.cpp:
    Contains the preprocessor directive #include "stdafx.h" and adds include files for precompiled types. Precompiled files of any type, including header files, support faster compilation times by restricting compilation only to those files that require it. Once your project is built the first time, you will notice much faster build times on subsequent builds because of the presence of the precompiled header files.
      

  3.   

    settings->c/c++
    category->precompiled headers