C/C ++, cc
From: http://www.cnblogs.com/yc_sunniwell/archive/2010/07/14/1777431.html
1. Only declarations are made in the header file.
Global variable declaration:
Extern int var;
Global function declaration:
Void test (void );
2. Effect of extern
When extern is not modified with "C", for example, extern int g_Int in the header file, it is used to declare the keyword of the range of the function or global variable.
When extern is connected with "C", for example, extern "C" void fun (int a, int B ); the compiler will tell the compiler to translate the corresponding function name instead of the C ++ name according to the C rule when compiling the function name fun,
// In the. h file header # ifdef _ cplusplus # if _ cplusplusextern "C" {# endif/* _ cplusplus */...... // Where the. h file ends # ifdef _ cplusplus # if _ cplusplus} # endif/* _ cplusplus */