SSPI header file - fatal error SSPI header file - fatal error windows windows

SSPI header file - fatal error


While the diagnostic is clear about having to define one of SECURITY_WIN32, SECURITY_KERNEL, or SECURITY_MAC, it doesn't help much in determining which one to use and why. To my knowledge, none of those are officially documented in the MSDN, so the only source of information are the actual header files.

  • SECURITY_MAC: This symbol only ever appears in <sspi.h>, a file with a copyright notice of 1992-1999. Presumably, this symbol was introduced to support compiling for "Classic" Mac OS, back when MFC was still planned to be a cross-platform framework targeting both Windows and Mac. The symbol doesn't appear to be of any practical use today.

  • SECURITY_KERNEL: The most enlightening comment here is from <NTSecPKG.h>, reading // Can't use the windows.h def'ns in kernel mode.. That appears to indicate that the SECURITY_KERNEL symbol needs to be defined, when accessing the security package from a module running in kernel mode.

  • SECURITY_WIN32: There are no comments on this symbol throughout the entire Windows SDK at all. It seems plausible, that this symbol should be used when accessing the security API from a user-mode application.

Assuming all of the above are correct, the following guideline can be used in determining the symbol to define:

  • Define SECURITY_WIN32 when compiling a user-mode application.
  • Define SECURITY_KERNEL when compiling a kernel-mode module.
  • Never define the obsolete SECURITY_MAC preprocessor symbol.


Just add

#define SECURITY_WIN32 

before all includes


Just to add to the existing answers, the preferable way to define it would be

#ifndef SECURITY_WIN32 #define SECURITY_WIN32 #endif

You could add this just before you #include the offending header file, or globally by adding it to you your stdafx.h (if you are using one) before your first call to windows.h or afxwin.h or whatever, at the same point that you define WINVER and _WIN32_WINNT, or you could of course just add it to your project settings.