在 VC++ CLR 项目中,我有一个类 temp。我正在尝试将静态变量 temp1 设置为 5。
我收到编译错误:
Error 32 error LNK2020: unresolved token (0A0005FB) "public: static int temp::temp1" (?temp1@temp@@2HA) C:\Users\user100\Documents\Visual Studio 2012\NewProject 32 bit\create min bar from data2\create min bar from data\create min bar from data5.obj
错误 33 错误 LNK2001: 无法解析的外部符号“public: static int temp::temp1”(?temp1@temp@@2HA) C:\Users\user100\Documents\Visual Studio 2012\NewProject 32 bit\create min bar from data2\从数据创建最小柱线\从 data5.obj 创建最小柱线
我该如何解决?
class temp
{
public:
static int temp1;
};
int main(array<System::String ^> ^args)
{
temp::temp1 = 5;
}