extern CAACafViewerManager * _ViewerManager=NULL;
CAACafViewerManager * _ViewerManager=NULL;
Ask a question like this in the CPP file defined in the global variables, with or without extern what's the difference?
CodePudding user response:
Say the answer first, before you the two words are equivalent, a word will have a warningC + + default is external links (that is, all symbols are visible to the public), and global variables are strong symbol (CPP) can only have one same name symbols in different, so if multiple CPP defined in the same symbols will be submitted to link the wrong
A CPP defined in another CPP global variable how to make use of, is done by extern declarations, extern int a; (note that cannot be assigned, assignment is defined, not statement) tells the compiler a is an external symbols, this module only used once, there is no definition of
Is probably so, if you want to understand thoroughly, can link to baidu inside under strong links symbols weak symbols C and C + + also not
CodePudding user response:
If the other file defines the variable with the same first not error a second complainsCodePudding user response:
Extern identifier is quoted elsewhere; Don't take extern is defined,