aa.cpp : static Ctest   *gp_test = 0;
bb.cpp 中声明:extern static Ctest   *gp_test ;  
错误 1 error C2159: 指定了一个以上的存储类 extern  Ctest   *gp_test ;
错误 1 error LNK2001: 无法解析的外部符号 
错误 2 fatal error LNK1120: 1 个无法解析的外部命令
在bb.cpp 文件中该怎么引用?谢谢.

解决方案 »

  1.   

    去掉static 后,有什么不同?
      

  2.   

    去掉static后aa文件定义了一个全局变量gp_test,而bb只是声明变量
      

  3.   

    static 的用法
    似乎有一个是只在局部有效 所以没办法被引用。
      

  4.   

    http://dev.firnow.com/course/3_program/c++/cppjs/20090912/175000.html
      

  5.   

    static Global variable: 文件作用域:只在声明的文件中有效,其他源文件中不可见;同时有了static的生命周期
    Global variable:文件作用域:可以加上extern 声明为外部变量,跨文件作用域