Why do many header files have “#ifdef __cplusplus” and “extern “C” { “?
#ifdef __cplusplus extern “C” { #endif //all of the code of a long header file goes here #ifdef __cplusplus } #endif if __cplusplus is defined, we are compiling C++ code extern “C” makes the compiler simply compile C code for example, if we used a namespace for the C code, the C code wouldn’t get a namespace since we told the compiler we only want fast C code.
Related Questions
- When using C++/CLI my imported files show up as C++ header files. How do I set the properties of these files so they are recognized by the form designer?
- Where can I find information on directory specifications, listing standards and Yellow Pages Header (YPH) files?
- gcc cannot find some of my header files. What is up with that?