在我的函数里面用 __try{}__except(1){}
出现错误: error C2712: Cannot use __try in functions that require object unwinding__try如何用,msdn上面的例子可以扑获这种异常:char* p = 0;*p = 10;我的程序中正好需要处理这种导致access violation的异常。
出现错误: error C2712: Cannot use __try in functions that require object unwinding__try如何用,msdn上面的例子可以扑获这种异常:char* p = 0;*p = 10;我的程序中正好需要处理这种导致access violation的异常。
C2712:cannot use __try in functions that require object unwindingWith /GX, a function with structured exception handling cannot have objects that require unwinding (destruction).Possible solutions Move code that requires SEH to another function.
Rewrite functions that use SEH to avoid the use of local variables and parameters that have destructors. Do not use SEH in constructors or destructors.
Compile using /GX-.
char * p = 0;
*p = 10; // 本身这条语句是没有错误的,但在运行时啃定会出错
比如 CString就有析构函数,但是LPCTSTR就没有