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 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.

Community Additions

ADD
Show:
© 2015 Microsoft