vs2017在使用try catch语句时,报出异常,不执行catch中的语句。
设置了/EHa,依然没用。在使用vs6.0时可以正常执行cartch中的语句
#include <iostream>
using namespace std;
int abc(int a, int b, int c)
{
if (a < 0)
throw "a<0";
return a + b + c;
}
int main()
{
try
{
cout << abc(-1, 2, 3) << endl;
}
catch (char* e)
{
cout << e << endl;
}
return 0;
}