/EH (Exception Handling Model)
Collapse the table of content
Expand the table of content
The document is archived and information here might be outdated

/EH (Exception Handling Model)


This option specifies the model of exception handling to be used by the compiler.

  • Use /EHs to specify the synchronous exception handling model (C++ exception handling without structured exception handling exceptions). If you use /EHs, do not rely on the compiler to catch asynchronous exceptions.
  • Use /EHa to specify the asynchronous exception handling model (C++ exception handling with structured exception handling exceptions).

The /EHc option requires that /EHs, /EHa, or /GX is specified. It tells the compiler to assume that extern C functions never throw an exception.

The option can be cleared by the symbol -. For example, /EHsc- is interpreted as /EHs /EHc-, and is equivalent to /EHs.

See Synchronous Exception Handling for more information.

To set this compiler option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see Setting Visual C++ Project Properties.
  2. Click the C/C++ folder.
  3. Click the Code Generation property page.
  4. Modify the Enable C++ Exceptions property.


  1. Click the C/C++ folder.
  2. Click the Code Generation property page.
  3. Set Enable C++ Exceptions to No.
  4. Click the Command Line property page.
  5. Type the compiler option in the Additional Options box.

To set this compiler option programmatically

See ExceptionHandling Property.

See Also

Compiler Options | Setting Compiler Options | Exception Specifications

© 2016 Microsoft