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

From RAD Studio
Jump to: navigation, search

Go Up to Compiler Errors And Warnings (C++) Index

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:

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