The following identifiers have no linkage: an identifier declared to be anything other than an object or a function; an identifier declared to be a function parameter; a block scope identifier for an object declared without the storage-class specifier extern.
{
static int a; //no linkage
}
For an identifier declared with the storage-class specifier extern in a scope in which a prior declaration of that identifier is visible, if the prior declaration specifies internal or external linkage, the linkage of the identifier at the later declaration is the same as the linkage specified at the prior declaration. If no prior declaration is visible, or if the prior declaration specifies no linkage, then the identifier has external linkage.
{
static int a; //no linkage
extern int a; //a should get external linkage, no?
}
GCC error: extern declaration of a follows declaration with no linkage
Can somebody explain me why do I get this error?
Thank you