Compiler Error C2319

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Compiler Error C2319.

try/catch' must be followed by a compound statement. Missing '{'

A try or catch block is not found following the try or catch statement. The block must be enclosed in curly braces.

The following sample generates C2319:

// C2319.cpp  
// compile with: /EHsc  
#include <eh.h>  
class C {};  
int main() {  
   try {  
      throw "ooops!";  
   }  
   catch( C ) ;    // C2319  
   // try the following line instead  
   // catch( C ) {}  
}  

Show: