18 Contributors: 1 Monday, February 27, 2017
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial:
Roadmap: roadmap

Linkage specifications


A linkage specification tells the compiler to compile declarations in a way that allows them to be linked together with declarations written in another language, such as C.


  • extern string-literal { declaration-seq(opt) }
  • extern string-literal declaration


The standard requires all compilers to support extern "C" in order to allow C++ to be compatible with C, and extern "C++", which may be used to override an enclosing linkage specification and restore the default. Other supported linkage specifications are implementation-defined.

Related Examples