頭文件問題001

頭文件中的    
  #if   _MSC_VER   >   1000  
  #pragma   once  
  #endif   //   _MSC_VER   >   1000  
  是什麼意思?  

 

 

MSDN上原文:  
   
  >>_MSC_VER    
  >>Defines   the   compiler   version.   Defined   as   1200   for   Microsoft   Visual   C++   6.0.   >>Always   defined.    
   
  >>_MFC_VER    
  >>Defines   the   MFC   version.   Defined   as   0x0421   for   Microsoft   Foundation   Class   >>Library   4.21.   Always   defined.    
   
  >>#pragma   once  
  >>Specifies   that   the   file,   in   which   the   pragma   resides,   will   be   included   (opened)   >>only   once   by   the   compiler   in   a   build.   A   common   use   for   this   pragma   is   the   >>following:  
  >>//header.h  
  >>#pragma   once  
  >>//   Your   C   or   C++   code   would   follow:  
   
  所以說_MSC_VER定義的是Microsoft   Visual   C++的版本而不是MFC的版本  
  #pragma   once即爲樓上們的意思,建議不會的先看MSDN:)  

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