可能重複:
static members and LNK error in C++
What does it mean to have an undefined reference to a static member?C++ static var。不編譯
我有這個類:
class A_GItem
{
public:
void create_item();
private:
static int static_index;
}
的create_item功能簡單,如:
void create_item() { static_index++; }
當編譯(乾淨後,試圖解決這個問題)我有: 錯誤LNK2001:無法解析的外部符號「私人:靜態INT A_GItem :: static_index
任何想法?由於