Turn: http://hi.baidu.com/nkhzj/blog/item/0c4ade167010a81b972b4307.html
Today, when using the dynamic_cast <> operator in vc6.0, an unknown warning is reported:
Warning c4541: 'dynamic _ cast' used on Polymorphic type 'class myobject' with/GR-; unpredictable behavior may result.
This warning is actually a serious error.ProgramException aborted, I can check and findCodeNo error ?! Later, when msdn queries the meaning of the compiler/GR options, it finally figured out this problem.
It turns out that the vc6.0 compiler does not support rtti in C ++ by default, so a warning will be issued when compiling a program containing the dynamic_cast or typeid operator. The "/GR-" option means to disable "/GR" (that is, grant rtti ). To remove this warning, enable the "/GR" option or directly add "/GR" to the compiler parameters.
The full text in msdn is described as follows:
/GR (enable run-time type information)
The enable run-time type information Option (/GR) causes the compiler to add code to check object types at run time. When this option is specified, the compiler defines _CpprttiPreprocessor macro. The option is cleared (/GR-) by default.
To find this option in the development environment, clickSettingsOnProjectMenu. Then clickC/C ++Tab, and click C++ LanguageInCategoryBox.