我不知道这段代码有什么问题。我有以下非常简单的课程:
class SetOfCuts{
public:
static LeptonCuts Leptons;
static ElectronCuts TightElectrons;
static ElectronCuts LooseElectrons;
//***
//more code
};
例如,ElectronCuts 类型之前在同一个 .h 文件中定义为:
struct ElectronCuts{
bool Examine;
//****
//other irrelevant stuff
};
没什么太复杂的,我想。
我的理解是,在主程序中,我可以这样做:
SetOfCuts::LooseElectrons.Examine = true;
但如果我这样做,我会得到:
undefined reference to `SetOfCuts::LooseElectrons'
相反,如果我这样做:
bool SetOfCuts::LooseElectrons.Examine = true;
我得到:
error: expected initializer before '.' token
我不知道为什么我不能访问结构的成员。我遗漏了一些关于静态数据成员的明显内容,但我不知道它是什么。
非常感谢。