did you forget to add stdafx.h problem

1. in vs environment program, if you don't add stadfx.h file to *.cpp file,the compiler will  recommend this error.
    the solution for this err is :

  property/c/C++/Precompileed Headers/Precompiled Header to "not Using Precompiled Headers".


2. stdafx.h文件介紹:

由於Windows和MFC的include文件都非常大,並且每個.CPP文件都包含相同的include文件,爲每個.CPP文件都重複處理這些文件就會非常不值得,爲了節省編譯時間,AppWizard在生成工程文件時,會自動生成stdafx.h以及stdafx.cpp文件。在編譯過程中VisualC++和AppWizard所做的工作爲:

   (1)AppWizard生成文件stdafx.h,該文件包含了當前工程文件需要的所有的MFCinclude文件,這一文件隨着選擇的選項爾變化;
   (2)AppWizard然後生成stdafx.cpp,這個文件通常都是一樣的;
   (3)AppWizard生成工程文件,此時第一個被編譯的文件就是stdafx.cpp文件;
   (4)VisualC++編譯stdafx.cpp文件時,它將結果保存在一個名爲stdafx.pch的文件裏。(擴展名pch表示預編譯頭文件。)
   (5)VisualC++編譯其它剩餘的.cpp文件時,它將會使用stdafx.pch文件。VisualC++不再分析編譯Windowsinclude文件,除非stdafx.cpp或stdafx.h這兩個文件又有了新的變化。


stdafx.pch文件是編譯之後一個非常大的文件,此文件中包含了大量的函數符號信息。


參考信息:http://blog.csdn.net/zhang_hui_cs/article/details/7541583


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章