Permalink
Fetching contributors…
Cannot retrieve contributors at this time
50 lines (34 sloc) 2.06 KB
title ms.custom ms.date ms.technology ms.topic f1_keywords dev_langs helpviewer_keywords ms.assetid author ms.author ms.workload
-GR (Enable Run-Time Type Information) | Microsoft Docs
11/04/2016
cpp-tools
reference
/gr
VC.Project.VCCLWCECompilerTool.RuntimeTypeInfo
VC.Project.VCCLCompilerTool.RuntimeTypeInfo
C++
-Gr compiler option [C++]
Gr compiler option [C++]
RTTI compiler option
/Gr compiler option [C++]
enable run-time type information compiler option [C++]
d1f9f850-dcec-49fd-96ef-e72d01148906
corob-msft
corob
cplusplus

/GR (Enable Run-Time Type Information)

Adds code to check object types at run time.

Syntax

/GR[-]

Remarks

When /GR is on, the compiler defines the _CPPRTTI preprocessor macro. By default, /GR is on. /GR- disables run-time type information.

Use /GR if the compiler cannot statically resolve an object type in your code. You usually need the /GR option when your code uses dynamic_cast Operator or typeid. However, /GR increases the size of the .rdata sections of your image. If your code does not use dynamic_cast or typeid, /GR- may produce a smaller image.

For more information about run-time type checking, see Run-Time Type Information in the C++ Language Reference.

To set this compiler option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see Working with Project Properties.

  2. Click the C/C++ folder.

  3. Click the Language property page.

  4. Modify the Enable Run-Time Type Info property.

To set this compiler option programmatically

  • See xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.RuntimeTypeInfo%2A.

See Also

Compiler Options
Setting Compiler Options