I have a header file and 5 different c++ files and I need this header included in all of my c++ files. I did not declare any cpp files with include "x.cpp" Anyone knows how can I fix this?( I have 6 headers and 5 cpp in total so I did not c/p all the code.)
#ifdef _DEBUG
#ifndef _UTIL_H_
#define _UTIL_H_
int LOOPCOUNTER=0;
int loopi;
#define LOOP LOOPCOUNTER++;
#define MARKLOOPS (loopi=LOOPCOUNTER);
#define PRINTLOOPS cout<<LOOPCOUNTER-loopi;
#define PRINTALLLOOPS cout<<LOOPCOUNTER<<endl;
#endif
#endif
and this is the error message:
1>linkedlistc.obj : error LNK2005: "int loopi" (?loopi@@3HA) already defined in arraylistc.obj
1>linkedlistc.obj : error LNK2005: "int LOOPCOUNTER" (?LOOPCOUNTER@@3HA) already defined in arraylistc.obj
1>main.obj : error LNK2005: "int loopi" (?loopi@@3HA) already defined in arraylistc.obj
1>main.obj : error LNK2005: "int LOOPCOUNTER" (?LOOPCOUNTER@@3HA) already defined in arraylistc.obj
1>C:\Users\Eko\Documents\Visual Studio 2010\Projects\mt1\Debug\mt1.exe : fatal error LNK1169: one or more multiply defined symbols found
1>