Compiler Warning (level 1) C4530
Collapse the table of content
Expand the table of content
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. ArchiveDisclaimer

Compiler Warning (level 1) C4530

Error Message

C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc

C++ exception handling was used but /EHsc was not selected.

When the /EHsc option has not been enabled, an object with automatic storage in the frame, between the function doing the throw and the function catching the throw, will not be destroyed. However, an object with automatic storage created in a try or catch block will be destroyed.

The following sample generates C4530:

// C4530.cpp
// compile with: /W1
int main() {
   try{} catch(int*) {}   // C4530

Compile the sample with /EHsc to resolve the warning.

© 2015 Microsoft