C ++: Is Windows.h usually an efficient code library?

I heard some people complaining about , including the Windows header file in a C ++ application and using . They noted that this is inefficient. Is it just some kind of urban legend or are there really some real facts? In other words, if you think this is effective or ineffective, explain how this can be with the facts.

I am not a C ++ Windows programmer. It would be very helpful to have detailed explanations.


* Edit: I want to know at compile time and runtime. Sorry for not mentioning this.

+3
source share
6 answers

If you recompile it, the difference in compilation speed is barely noticeable. The disadvantage of precompiling is that you can only have one precompiled header for each project, so people tend to create one "precompiled.h" (or "stdafx.h") and include windows.h, boost, stl and everything else they need there. Of course, this means that you end up including windows.h files in every .cpp file, not just the ones that need it. This may be a problem in cross-platform applications, but you can work around this by doing all your win32-specific things in a static library (which is precompiled by Windows.h) and linking to it in your main executable.

windows.h , Windows. "".

, , Windows GUI, (Qt, wxWidgets, MFC ..), Win32, windows.h( ), , , Windows windows.h .

+3

windows.h " ". ( , - , ).

, , - . , , , Platform SDK, VS2010, #include <windows.h> ~ 2,4 , .

, ( , , ), .

+3

, #including windows.h . Windows , , .

, preproc , windows.h :

#define WIN32_LEAN_AND_MEAN
#define VC_EXTRALEAN
#include <windows.h>

windows.h - . , , , def.

, , . , , - , . Windows , . #include windows.h .cpp , .h.

, windows.h. , . - , , (.cpp).

, Windows API . , - , Windows API. , , - /- . Windows API , .

+2

, .

<windows.h> . . , <windows.h>, .

, , ( 2 PCH) , PCH. , Windows PCH. , , .

. , #include <windows.h>, - , , , . , .

: " Windows ?" , : Windows , , . , , , "Winblowz sucks" " Windows, ". . Windows, , .

+1

, windows.h : Windows, . , ( ) windows.h. .h, windows.h, windows.h .cpp . , , , , .h .h , , windows.h n .

+1
  • .
0

Source: https://habr.com/ru/post/1742362/


All Articles