我正在使用交叉編譯器。我的代碼是:對靜態成員的未定義引用
class WindowsTimer{
public:
WindowsTimer(){
_frequency.QuadPart = 0ull;
}
private:
static LARGE_INTEGER _frequency;
};
我得到以下錯誤:
undefined reference to `WindowsTimer::_frequency'
我也試圖將其更改爲
LARGE_INTEGER _frequency.QuadPart = 0ull;
或
static LARGE_INTEGER _frequency.QuadPart = 0ull;
,但我仍然有錯誤。
有人知道爲什麼嗎?
可能重複的[未定義的靜態成員,鏈接器錯誤引用](http://stackoverflow.com/questions/9074073/undefined-reference-to-baseobject-linker-error-cw-freeglut) – iammilind 2012-02-02 10:15:22
哪裏(如果任何地方)你有_defined_'WindowsTimer :: _頻率嗎? – 2012-02-02 10:16:03
@CharlesBailey它是我在班上唯一的成員。 – kakush 2012-02-02 10:35:17