Partager via


Erreur du compilateur C2317

bloc 'try' commençant ligne 'number' n’a pas de gestionnaires de l’interception

Un bloc try doit avoir au moins un gestionnaire catch.

L’exemple suivant génère l’erreur C2317 :

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

Résolution possible :

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