Including system C header files from C++

C header files must be wrapped in extern "C" directives before they are included from C++. Standard system C header files already contain the appropriate extern "C" directives so you do not have to take any special steps to include such files. Different #include syntaxes determine what namespace to use and therefore the type of access you have.

For example:

#include <stdio.h>
int main()
{
    ...       // C++ code
    return 0;
}

If you include headers using this syntax, all library names are placed in the global namespace.

The C++ standard specifies that the functionality of the C header files is available through C++ specific header files. These files are installed in install_directory\include, together with the standard C header files, and can be referenced in the usual way. For example:

#include <cstdio>

In ARM C++, these headers #include the C headers. If you include headers using this syntax, all C++ standard library names are defined in the namespace std, including the C library names. This means that you must qualify all the library names by using one of the following methods:

Show/hideSee also

Reference

Compiler Reference:

Copyright © 2010-2012 ARM. All rights reserved.ARM DUI 0471G
Non-ConfidentialID021412