not able to disable exception boost managed_mapped_file

142 views Asked by At

I am having problems compiling my application with boost::managed_mapped_file without exceptions. am compiling it with the flags -DBOOST_NO_EXCEPTIONS -DBOOST_NO_EXCEPTIONS but still get

g++ -c -Wall -g -O0 -Wno-write-strings -fno-exceptions -DBOOST_NO_EXCEPTIONS -DBOOST_NO_EXCEPTIONS -I./ -I../Include/   UT_main.cpp -o UT_main.o"

In file included from /usr/include/boost/interprocess/mapped_region.hpp:18
from /usr/include/boost/interprocess/detail/managed_open_or_create_impl.hpp:17
from /usr/include/boost/interprocess/managed_mapped_file.hpp:20
from ../Include/MyMng.h:11
from main.cpp:7:
/usr/include/boost/interprocess/exceptions.hpp: In constructor interprocess_exception
/usr/include/boost/interprocess/exceptions.hpp:40: error: exception handling disabled, use -fexceptions to enable

from what i see in the code whenever the the -DBOOST_NO_EXCEPTIONS is on the interprocess/exceptions.hpp is still included but only the "include " is not included. It seems that the code should work withould exceptions.

if someone can tell me what am i missing thanks

1

There are 1 answers

0
sehe On

Compiling that library isn't supported without exceptions.

Many functions are explicitly documented (e.g. on existing files when using create_only).

The throws are unconditional (IOW it doesn't use Boost Exception's macros to replace exceptions by a user-defined callback).

For completeness: the header you see in the message fails to compile because it uses try/catch internally (to avoid exceptions during exception handling).