Export (0) Print
Expand All
Expand Minimize
3 out of 4 rated this helpful - Rate this topic

/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

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.