Compiler Error C2317
TOC
Collapse the table of content
Expand the table of content
The document is archived and information here might be outdated

Compiler Error C2317

Error Message

'try' block starting on line 'number' has no catch handlers

A try block must have at least one catch handler.

The following sample generates C2317:

// C2317.cpp
// compile with: /EHsc
#include <eh.h>
int main() {
   try {
      throw "throw an exception";
   }
   // C2317, no catch handler
}

Possible resolution:

// C2317b.cpp
// compile with: /EHsc
#include <eh.h>
int main() {
   try {
      throw "throw an exception";
   }
   catch(char*) {}
}
Show:
© 2016 Microsoft