RAD Studio |  |

E2470: Need to include header <typeinfo> to use typeid (C++)

When you use the 'typeid' function, you have to include the <typeinfo> header, otherwise you will get syntax errors.

For example, consider a test case with the following code:

Copy Code

    int func()
    {
      char * name = typeid(int).name();  // This causes an error
    }

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!