I keep running into problem with the linker eventhough I already put the guard in the header files. Here're the errors that I get
here's the header
Code:
#ifndef __TANK__WAR__
#define __TANK__WAR__
#include <allegro.h>
#include <cstdlib>
int gameover = 0 ;
// Tank Structure
struct tagTank
{
int x , y;
int dir , speed;
int color;
int score;
} tanks[2];
// Bullet Structure
struct tagBullet
{
int x , y;
int alive;
int xspd , yspd;
} bullets[2];
... some code
#endif
Code:
1>------ Build started: Project: FirstAllegro, Configuration: Debug Win32 ------
1>TankWar.obj : error LNK2005: "struct tagBullet * bullets" (?bullets@@3PAUtagBullet@@A) already defined in main.obj
1>TankWar.obj : error LNK2005: "struct tagTank * tanks" (?tanks@@3PAUtagTank@@A) already defined in main.obj
1>TankWar.obj : error LNK2005: "int gameover" (?gameover@@3HA) already defined in main.obj
1>C:\Users\admin\Documents\Visual Studio 2010\Projects\FirstAllegro\Debug\FirstAllegro.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
What could cause this? I thought guard would overcome this error.