在使用CAA C ++接口为Catia开发插件时,我需要进行dynamic_cast:
DerivedClass *derived = dynamic_cast<*derived>(base);
当Build with mkmk
时,编译器发出警告:
[MkMk] warning C4541: 'dynamic_cast' used on polymorphic type '<DerivedClass>' with /GR-; unpredictable behavior may result
我试图通过在模块的LOCAL_CCFLAGS = /GR
中添加Imakefile.mk
来启用运行时类型信息。但是编译器会覆盖此标志并禁用RTTI:
[MkMk] Command line warning D9025 : overriding '/GR' with '/GR-'
[MkMk] warning C4541: 'dynamic_cast' used on polymorphic type '<DerivedClass>' with /GR-; unpredictable behavior may result
如何正确启用RTTI?