c++visual-studio-2008include

How to not #include <windows.h>


Using MSVC2008, 32bit on 64bit system.

I was once advised to never include windows.h as 'its a real monster and will slow down my compile times significantly'.

I tried leaving it out and obviously get compile errors. I included windef.h to define all the DWORDs etc, but I quickly come unstuck knowing what else to define to get the code to compile.

I now get:

2>c:\program files\microsoft sdks\windows\v7.0\include\winnt.h(6361) : error C2146: syntax error : missing ';' before identifier 'ContextRecord'
2>c:\program files\microsoft sdks\windows\v7.0\include\winnt.h(12983) : error C2065: 'PCONTEXT' : undeclared identifier

Can anyone suggest the right approach here?

Thanks

Simon


Solution

  • Internally, windows.h respects many defines, like NOMINMAX or WIN32_LEAN_AND_MEAN.

    It reduces the times significantly.