????????????????
??????global.h????????????
????int sharedData = 9;
???????????
????Building target: CTest
????Invoking: GCC C++ Linker
????g++  -o "CTest"  ./src/CTest.o ./src/global.o
????./src/global.o:(.data+0x0): `sharedData'????ζ???
????./src/CTest.o:(.data+0x0)?????????????
????collect2: ???? ld ???? 1
???????????????
??????global.h????????
????extern int sharedData ;
??????global.cpp????????
????int sharedData = 9;
???????????????????????????
????int main(void)
????{
????cout<<sharedData<<endl;
????return 0;
????}
???????e????????????????????????????????
????extern int sharedData ;
????????±???
make all
Building file: ../src/CTest.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/CTest.d" -MT"src/CTest.d" -o "src/CTest.o" "../src/CTest.cpp"
Finished building: ../src/CTest.cpp
Building file: ../src/global.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/global.d" -MT"src/global.d" -o "src/global.o" "../src/global.cpp"
Finished building: ../src/global.cpp
Building target: CTest
Invoking: GCC C++ Linker
g++  -o "CTest"  ./src/CTest.o ./src/global.o
Finished building target: CTest
?????????
????CTest.cpp?????CTest.o  ????????????global????????????????ν??????????????????CTest.cpp???global??????????????????
?????????
????global.cpp?????global.o
??????????
????????CTest.o??global.o  ??????????????CTest??