I would like to disable RTTI in a project of mine. However, this project uses Boost Program Options which itself depends on Boost Any which does not support -fno-rtti.

I was wondering if there was any solution to use Boost Program without RTTI ? By defining a macro or by not using some of the features ?

Thanks

有帮助吗?

解决方案

The answer is "no". Boost.PO is based on Boost.Any and this dependence can't be avoided by users currently. Boost.Any gives the main storage structure of Boost.PO so you can't compile some useful part of PO without Any.

其他提示

The answer is "maybe". Some boost libraries will work with exceptions disabled - some will not. Same for RTTI.

I suggest you check the documentation for the particular boost libraries that you are interested in.

For example, Boost.Array will work with exceptions disabled, but Boost.Format will not.

If you are getting messages like cannot use typeid with -fno-rtti, that will probably be while compiling some part of Boost that requires RTTI. Where the error occurs will tell you which library (usually).

You can try BOOST_NO_RTTI and BOOST_NO_TYPEID ...

http://www.boost.org/doc/libs/1_46_1/libs/exception/doc/configuration_macros.html

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top