2013-06-05 61 views

回答

4

在windows.h頭,如果沒有定義WIN32_LEAN_AND_MEAN,預處理器將包含其他頭。所以,如果你想不包括論文標題,則必須的#include之前定義WIN32_LEAN_AND_MEAN,否則它不會有任何影響

#ifndef WIN32_LEAN_AND_MEAN 
#include <cderr.h> 
#include <dde.h> 
#include <ddeml.h> 
#include <dlgs.h> 
#ifndef _MAC 
    #include <lzexpand.h> 
    #include <mmsystem.h> 
    #include <nb30.h> 
    #include <rpc.h> 
#endif 
#include <shellapi.h> 
#ifndef _MAC 
    #include <winperf.h> 
    #include <winsock.h> 
#endif 
#ifndef NOCRYPT 
    #include <wincrypt.h> 
    #include <winefs.h> 
    #include <winscard.h> 
#endif 

#ifndef NOGDI 
    #ifndef _MAC 
     #include <winspool.h> 
     #ifdef INC_OLE1 
      #include <ole.h> 
     #else 
      #include <ole2.h> 
     #endif /* !INC_OLE1 */ 
    #endif /* !MAC */ 
    #include <commdlg.h> 
#endif /* !NOGDI */ 
#endif /* WIN32_LEAN_AND_MEAN */ 
從WINDOWS.H

直接

+0

如果我只想將下面的頭文件排除在外,我應該怎麼寫? 的#include 的#include 的#include 的#include zzz

+0

WINDOWS.H之前定義WIN32_LEAN_AND_MEAN,並添加你想要什麼手動包括(不要忘記WINDOWS.H)。 – Nic007

+0

因此,通過使用#define WIN32_LEAN_AND_MEAN,所有上述頭文件都將被排除。如果你想要返回一些頭文件,只需#include前面#include 。我對嗎? – zzz

3

該命令是錯誤的。 WIN32_LEAN_AND_MEAN影響什麼windows.h聲明,所以它需要,才能將windows.h被定義爲:

#define WIN32_LEAN_AND_MEAN 
#include <windows.h> 
+0

很好的回答,只是爲今後的[參考] (http://stackoverflow.com/questions/11040133/what-does-defining-win32-lean-and-mean-exclude-exactly) – dowhilefor