I want to disable exceptions in my C++ aplication, compiled under MSVC. I hve switched the option Enable C++ exceptions to NO, but I get warnings telling me to use the optio
The type id is to do with run-time type identification. You may want to try turning RTTI off as well.
However, certain parts of the C++ Standard Library are specified to throw exceptions. If you disable them you are sailing into the murky waters of "undefined behaviour".
Microsoft STL supports exception deactivation.
For MSVC STL defining macro _HAS_EXCEPTIONS=0 disables exceptions in case you link your application with libcmt.lib/libcmtd.lib (/MT or /MTd compiler option).
If you link with msvcrt.lib/msvcrtd.lib (/MD or /MDd compiler option) you need to define one more macro - _STATIC_CPPLIB. In this case either add the following lines before including any STL code:
#define _HAS_EXCEPTIONS 0
#define _STATIC_CPPLIB
or add the following to compiler options:
-D_HAS_EXCEPTIONS=0 -D_STATIC_CPPLIB
Please note that you need to disable C++ exceptions in your project settings.
You need to use an STL that supports exception deactivation. This is generally a compile-time macro definition.
Unless I am mistaken, STLPort offers this with _STLP_USE_EXCEPTIONS=0 and _STLP_NO_EXCEPTIONS. I don't know how the programs behave with these settings. ;)
I think there is some hidden flag in the MS STL as well.
The EASTL comes out of the box with exceptions disabled:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2271.html