64,542
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
using namespace std;
class A
{
public :
static int i;
static void get();
};
void A::get()
{
i=1;
cout<<i<<endl;
}
int main()
{
A::get();
}
$ g++ 1.cc -o 1
/tmp/ccIDx2EB.o: In function `A::get()':
1.cc:(.text+0x72): undefined reference to `A::i'
1.cc:(.text+0x99): undefined reference to `A::i'