在Visual Studio 2010编译选项中启用C++异常

pen*_*uru 7 c++ visual-studio-2010 c++11

我正在尝试编译此源代码:

// exception_set_unexpected.cpp
// compile with: /c /EHsc
#include<exception>
#include<iostream>

using namespace std;

void unfunction( ) 
{
   cout << "I'll be back." << endl;
   terminate( );
}

int main( ) 
{
   unexpected_handler oldHand = set_unexpected( unfunction );
   unexpected( );
}
Run Code Online (Sandbox Code Playgroud)

如何compile with: /c /EHsc在Visual Studio 2010中添加选项?

Dum*_*der 5

右键单击您的项目 - >属性 - >配置属性 - > C/C++ - >命令行

将标志放在命令行中