user33134: I need dynamic casts for my project, I'm getting:
error: 'dynamic_cast' not permitted with -fno-rtti

It appears that RTTI (run-time type information) is disabled with the fno-rtti compiler flag.
How do I change this?

user3917: It apparently is true that “RTTI (run-time type information) is disabled with the fno-rtti compiler flag”; however, looking at compiler.c.flags and compiler.cpp.flags in platform.txt, no fno-rtti compiler flag is set, suggesting that gcc sets it by default.
One way to turn off fno-rtti is adding a -frtti flag into the appropriate flags string in platform.txt.  As a side effect, this will affect all sketches subsequently compiled, rather than only those that need dynamic casts.
Note, on a microcontroller, a more-appropriate way to deal with the problem is getting rid of the need for dynamic casts, via function overloading.
Edit 1: On Linux, typical file paths to platform.txt are like /opt/arduino-1.6.3/hardware/arduino/avr/platform.txt or /opt/arduino-1.8.0/hardware/arduino/avr/platform.txt.  I don't know the location on OSX.  However, a command like locate *avr/platform.txt should reveal its location.  (If locate is a new install on your system, first run updatedb, which may take a while.)

33134: <p>I need dynamic casts for my project, I'm getting:</p>

<pre><code>error: 'dynamic_cast' not permitted with -fno-rtti
</code></pre>

<p>It appears that RTTI (run-time type information) is disabled with the <code>fno-rtti</code> compiler flag.</p>

<p>How do I change this?</p>
 3917: <p>It apparently is true that “RTTI (run-time type information) is disabled with the <code>fno-rtti</code> compiler flag”; however, looking at <code>compiler.c.flags</code> and <code>compiler.cpp.flags</code> in <code>platform.txt</code>, no <code>fno-rtti</code> compiler flag is set, suggesting that gcc sets it by default.</p>

<p>One way to turn off <code>fno-rtti</code> is adding a <code>-frtti</code> flag into the appropriate flags string in <code>platform.txt</code>.  As a side effect, this will affect all sketches subsequently compiled, rather than only those that need dynamic casts.</p>

<p>Note, on a microcontroller, a more-appropriate way to deal with the problem is getting rid of the need for dynamic casts, via function overloading.</p>

<p><em>Edit 1:</em> On Linux, typical file paths to <code>platform.txt</code> are like <code>/opt/arduino-1.6.3/hardware/arduino/avr/platform.txt</code> or <code>/opt/arduino-1.8.0/hardware/arduino/avr/platform.txt</code>.  I don't know the location on OSX.  However, a command like <code>locate *avr/platform.txt</code> should reveal its location.  (If <a href="http://osxdaily.com/2011/11/02/enable-and-use-the-locate-command-in-the-mac-os-x-terminal/" rel="nofollow noreferrer"><code>locate</code> is a new install on your system, first run <code>updatedb</code></a>, which may take a while.)</p>
