如:a.cpp 声明 int a=9; 要在b.cpp文件中使用变量 a extern int a; int b=1; cout<<a+b; 结果为10; 转载于:https://www.cnblogs.com/lvlv/p/4135716.html