test.cpp:
#include"head.h"
int i=3;
main.cpp
#include"head.h"
#include
using namespace std;
extern int i;
int main(){
cout << i<< endl;
system("pause");
return 0;
}
head.h
#ifndef HEAD_H
#define HEAD_H
int ab = 0;
#endif
这个项目出现了重定义的问题,不知道为什么?求解答