It was necessary to test one project for VS to check the compatibility of the code, in general, everything is going, but it gives the following:

warning C4530: Использован обработчик исключений C++, но семантика уничтожения объектов не включена. Задайте параметр /EHsc 

the project is going to be built through the Makefile What kind of trouble is this? and what exactly does he really want? except to add a key.

  • If exceptions are used, the project should be compiled with the /EHsc . - VTT
  • ... otherwise, objects created in functions called within a try block may not be correctly destroyed. Details - Fat-Zer
  • Thanks, that is for MSVS it is necessary to add this key CFLAGS . @ Fat-Zer, issue in the form of the answer, I will mark as correct. - NewView
  • hmmm ... I don’t like to give answers to things that I don’t understand and can’t check ... if no one else makes them out, then if I don’t forget, I'll write in a couple of days. - Fat-Zer
  • ok, we are waiting :) - NewView

1 answer 1

As the warning says, C ++ code is compiled with exception handlers, but the /EH key is not specified. If you believe the documentation , then in this case objects with automatic storage time created in functions called inside a try block may not be destroyed correctly, which is what the compiler reports.

As described in the help , the /EHsc sets the exception handling mode:

  • s indicates that only C ++ exceptions should be handled, but not SE (see below).
  • c indicates that functions declared as extern C cannot throw out C ++ exceptions; therefore, the compiler has the right to apply some overhead optimization.
  • It is also possible to specify the a parameter (instead of sc ), in which the usual catch(...) block, in addition to the usual C ++ exceptions, will catch structured exceptions , which are usually caught inside the non- __try / __except blocks.