Fatal Error C1189

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Fatal Error C1189.

error : user supplied error message

C1189 is generated by the #error directive. The developer who codes the directive specifies the text of the error message. For more information, see #error Directive (C/C++).

The following sample generates C1189. In the sample, the developer issues a custom error message because the _WIN32 identifier is not defined:

// C1189.cpp  
#undef _WIN32  
#if !defined(_WIN32)  
#error _WIN32 must be defined   // C1189  
#endif  

You might also see this error if you build an ATL project by using the /robust MIDL compiler option. Use the /robust switch to build only Windows 2000 and later versions of Windows. To correct this error, use one of the following procedures:

  • Change this line in the dlldatax.c file:
#define _WIN32_WINNT 0x0400   // for WinNT 4.0 or Windows 95 with DCOM  

to:

#define _WIN32_WINNT 0x0500   // for WinNT 4.0 or Windows 95 with DCOM  

  • Use the Advanced property page in the MIDL property page folder to remove the /robust switch and then specify the /no_robust switch. For more information, see MIDL Property Pages: Advanced.

#define Directive (C/C++)

Show: