0
C headerfiles and redefinition error
hi, I have problem with Visual C compiler cause I made some header files and I included them in my project main source, and I defined 3 arrays in one of those header files, unfortunately I get redefinition error on those lines which I defined the arrays. How can I solve this problem?
3 Respostas
+ 1
would you please share your code?
0
this is the header file which the error is made in:
#include<stdlib.h>
#include"graphics.h"
#define BOARD_WIDTH 5
#define PLAYER1 true
#define PLAYER2 false
int mapV[BOARD_WIDTH + 1][BOARD_WIDTH]; /* define this for vertical lines*/
int mapH[BOARD_WIDTH][BOARD_WIDTH + 1]; /*define this for horizontal lines*/
int scores[BOARD_WIDTH][BOARD_WIDTH]; /*define this for saving scores along the game*/
bool turn; /*this boolean value is set save the turn along the game*/
bool checkInputs(int z, int x, int y, int mapV[BOARD_WIDTH + 1][BOARD_WIDTH], int mapH[BOARD_WIDTH][BOARD_WIDTH + 1]);
void initMapAndScores(int mapV[BOARD_WIDTH + 1][BOARD_WIDTH], int mapH[BOARD_WIDTH][BOARD_WIDTH + 1], int score[BOARD_WIDTH][BOARD_WIDTH]);
void DecidePlayerTurn(bool turn);
int GameRun(bool turn);
0
in addition to this header file I have some others but not related to this header file,only they'll included in my mainsource.c but this gives me a redefinition error