Multiple definitions of "board". Here are my files.
main.cpp
global_functions.cppCode:#include <stdlib.h> #include "global_functions.h" int main(int argc, char** argv) { initialize_game(); return (EXIT_SUCCESS); }
Code:#include "global_functions.h" #include <iostream> #include <stdio.h> void initialize_game(){ //set the board up in the initial configuration std::cout << "Who goes first?" << std::endl; std::cout << "P for player" << std::endl; std::cout << "C for computer" << std::endl; char response; std::cin.get(response);}I don't see how the board is being defined multiple times. The file is getting included twice but the inclusion guards should take care of that. Can anybody see what I did wrong?Code:#ifndef _GLOBAL_FUNCTIONS_H #define _GLOBAL_FUNCTIONS_H enum{A, B, C, D, E, COLUMNS}; enum{PROOK, PPAWN, PKNIGHT, PBISHOP, CBISHOP, CKNIGHT, CPAWN, CROOK, ROWS}; int board[ROWS][COLUMNS]= {{0,1,1,1,0}, {1,1,1,1,1}, {0,0,1,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,2,0,0}, {2,2,2,2,2}, {0,2,2,2,0}}; void initialize_game(); #endif /* _GLOBAL_FUNCTIONS_H */