Windows Structured Exception Handling: simple test program will not compile.

Posted by Jon on Stack Overflow See other posts from Stack Overflow or by Jon
Published on 2010-06-10T15:38:57Z Indexed on 2010/06/10 15:42 UTC
Read the original article Hit count: 283

Filed under:
|
#include <windows.h>

int main()
{

    int* i = (int*)malloc(sizeof(int));
    *i = 5;

    __try
    {
        free(i);
        free(i);
    }
    __except
    {
        return -1;
    }


return 0;
}

I am trying to learn more about windows SEH. My first test program is giving me some real trouble. I have looked at the msdn documentation and I am still not really sure what I have wrong. I am getting the following errors when I try to compile this program:

error C2059: syntax error : '{'
error C2143: syntax error : missing ';' before '{'

both on line 15.

Thanks.

© Stack Overflow or respective owner

Related posts about win32

Related posts about seh