c++visual-c++cl

How to turn off exceptions in Microsoft compiler(cl)?


What compiler flags do I use to completely get rid of the exception handling? I don't use them at all but the compiler still generates .pdata and .xdata sections which there for exception handling only.


Solution

  • In your project properties set the Enable C++ Exceptions to No: Disable C++ Exceptions

    and enable the unwind semantics by specifying the /EHsc flag: Unwind semantics

    To set this option on command line you would leave out the /EHa, /EHsc and /EHs flags from the [option] section as described in the Compiler Command-Line Syntax manual. Further relevant MSDN reading: