Here is the code:
Code://file main.cc
//NOTE: main.cc does NOT include any file
extern int a1;
extern int a2;
int main(){
cout<<a1<<a2<<endl;
}
Code://file test.cpp
int a1=5;
It seems that a1 can be externed to main.cc , but a2 can not. Why is that?Code://file test.h
int a2=6;