Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Warning (level 3) C4535

Error Message

calling _set_se_translator() requires /EHa

The use of _set_se_translator requires the /EHa compiler option and not /EHs.


The following sample generates C4535.

// C4535.cpp
// compile with: /W3 /EHsc /c
// C4535 expected
// to fix, compile with /EHa instead
#include <stdio.h>
#include <windows.h>
#include <eh.h>

void SEFunc();
void trans_func( unsigned int, EXCEPTION_POINTERS* );

class SE_Exception {
   unsigned int nSE;
   SE_Exception() {}
   SE_Exception( unsigned int n ) : nSE( n ) {}
   ~SE_Exception() {}
   unsigned int getSeNumber() { return nSE; }

int main() {
   try {
      _set_se_translator( trans_func );
   catch( SE_Exception e ) {
      printf_s( "Caught a __try exception with SE_Exception.\n" );

void SEFunc() {
   __try {
      int x, y=0;
      x = 5 / y;
   __finally {
      printf_s( "In finally\n" );

void trans_func( unsigned int u, EXCEPTION_POINTERS* pExp ) {
   printf_s( "In trans_func.\n" );
   throw SE_Exception();

Community Additions

© 2015 Microsoft