在VC++ CLR項目我有一個類臨時, 我想設置靜態變量temp1中,以5 我得到一個編譯錯誤:C++如何給類中的靜態變量賦值?
Error 32 error LNK2020: unresolved token (0A0005FB) "public: static int temp::temp1" ([email protected]@@2HA) C:\Users\user100\Documents\Visual Studio 2012\NewProject 32 bit\create min bars from data2\create min bars from data\create min bars from data5.obj
Error 33 error LNK2001: unresolved external symbol "public: static int temp::temp1" ([email protected]@@2HA) C:\Users\user100\Documents\Visual Studio 2012\NewProject 32 bit\create min bars from data2\create min bars from data\create min bars from data5.obj
我怎樣才能解決這個問題?
class temp
{
public:
static int temp1;
};
int main(array<System::String ^> ^args)
{
temp::temp1=5;
}
'int main(array^args)'對我來說看起來不像C++。 –
Marius
它是託管的C++。 –