在使用 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?