这完全是C++的概念,在VC中要求更为严格,
在VC中定义树组最好在.hpp中定义。

解决方案 »

  1.   

    view.h:extern COLORREF arColors[5];view.cpp:
    COLORREF arColors[5] =
    {
        RGB(0,0,0),
        RGB(255,0,0),
        RGB(0,255,0),
        RGB(0,0,255),
        RGB(255,255,255)
    };
      

  2.   

    最好不要在头文件中定义变量,如果被多个.cpp文件包含,就会报上述错误。如果添加了static,该变量只在当前头文件可见。
    When modifying a variable or function at file scope, the static keyword specifies that the variable or function has internal linkage (its name is not visible from outside the file in which it is declared).