../Manager.o:(.data+0x0): multiple definition of Cdebug::n'
Cdebug::n'
/tmp/ccm2hcIk.o:(.data+0x0): first defined here
../Epoller.o:(.data+0x0): multiple definition of
/tmp/ccm2hcIk.o:(.data+0x0): first defined here
collect2: error: ld returned 1 exit status
Cdebug的源码如下:
#ifndef DEBUG_H
#define DEBUG_H
class Cdebug{
.....
private:
static int n;
}
int Cdebug::n=1;
#endif
这里我已经用#ifndef 防止头文件重复导入,为什么还会出错?